el-select组件选中不显示的原因好像只出现在多级联动中,并且选中是有值的,只是单纯的不回显,可以在el-select中加入change事件,然后使用vue的set方法将值重新修改进去
<el-select style="width:60%;margin-left:10px" @change="abc" v-model="temp.region" placeholder="负责人">
<el-option
v-for="(item,index) in staff"
:label="item.name"
:value="item.sid"
:key="index"
></el-option>
</el-select>
//@change="abc"
abc(val){
console.log("abc",val)
//使用set重新赋值后一切正常
this.$set(this.temp, this.temp.region, val)
}
本文探讨了el-select组件在多级联动场景下选中项不显示的问题,并提供了解决方案。通过在el-select中加入change事件,使用Vue的set方法重新赋值,可以有效解决该问题。
1万+

被折叠的 条评论
为什么被折叠?



