需求:
1.select框的内容默认为空
2.选中下拉框中的数值后,select框的内容等于选中的值
html部分代码如下:
<a-form-model ref="ruleForm" :model="formModel" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
<a-form-model-item label="箱型箱类" prop="containerType">
<a-select v-model="formModel.containerType" allowClear>
<a-select-option :value="item.value" v-for="(item, index) in containerTypeList" :key="index">
{{ item.value }}
</a-select-option>
</a-select>
</a-form-model-item>
</a-form-model>
js部分代码如下:
export default {
data() {
return {
formModel:{
containerType: ''
},
containerTypeList: [{ value: '01' }, { value: '02' }, { value: '03' }, { value: '04' }]
}
}
}
最终效果如图: