1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > ant-design-vue select选择器重置

ant-design-vue select选择器重置

时间:2019-01-17 23:45:59

相关推荐

ant-design-vue select选择器重置

场景:触发"重置"按钮,将下拉框值所选值清除

问题:重置方法中anId=''或者null后,选择值时选择器选择值不显示

当你的select-option是循环出来的时候,你点击清空以后这个值是不会清空的,当你使用组件自带的api– allowClear的时候,你会发现清空以后是undefined,所以当你清空的时候,你可以在select标签上使用v-model。

<a-row><a-col :span="12"><a-form-model-item label="所属公司" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="organId"><a-select placeholder="请选择公司" v-model="organId" @change="organChange($event)"><a-select-option v-for="(item, index) in organTree" :key="index" :value="item.id">{{ item.name }}</a-select-option></a-select></a-form-model-item></a-col></a-row>

data () {return {organId:undefinedorganTree: []}}organChange(e) {anId = e},// 重置searchResetData () {anId = undefined;},

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。