1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > Vue+Element UI中Select下拉框绑定对象

Vue+Element UI中Select下拉框绑定对象

时间:2022-04-24 20:40:09

相关推荐

Vue+Element UI中Select下拉框绑定对象

在开发过程中使用Element UI中Select下拉框时可能会遇到绑定对象的情况,总结如下:

<el-select v-model="productionClassId" value-key="id" @change="deptChangeVal" style="width:200px" placeholder="请选择"><el-optionv-for="item in optionsDept":key="item.id":label="item.title":value="item"></el-option></el-select>

value-key:作为 value 唯一标识的键名,绑定值为对象类型时必填

data () {return {productionClassId: '', // select上绑定的值}}methods:{// 选中值时获取对象deptChangeVal(val){console.log(val,'选中对象');},// 编辑回显时editBtn(row){this.dialogFormVisible = true;this.productionClassId = row.productionClassName;},}

测试有效!!!

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