数据是从接口获取的大量数据,点击选项后,在 change 函数中查看是值已经发生变化了,但在页面上没有显示新改变后的值,也就是下拉框的值无法选中。
解决方法:在 el-select 加一个 change 事件刷新一下
el-select 的 change 事件绑定 refreshData 方法:
<el-select v-model="co.attrs.labelIds" multiple filterable default-first-option placeholder="请选择" @change="refreshData">
<el-option v-for="(item,i) in topicLabelOptions" :key="'lab'+i" :label="item.name" :value="item.id">
</el-option>
</el-select>
在 methods{} 方法加上 refreshData,运用 this.$forceUpdate()强制刷新:
refreshData (val) {
this.$forceUpdate()
}