iview UI table 中使用render函数实现Select,实现双向绑定
- 老早就实现了双向绑定,但是,但是,初始化的时候一直 undefined 。搞了几天之后发现,排除所有可能,最终发现是iview版本问题,去官网用他的示例版本就行了。
render: (h, params) => {
return h('Select', {
props: {
value: params.row.name,
},
on: {
'on-change': (e) => {
params.row.name= e;
}
},
},
this.checkLists.map(function (item) {
return h('Option', {
props: {
value: item.value,
label: item.label
}
});
})
- 这样就是对的写法,要是undefined,就更换版本!!!!!!!!!!!!!!
- 欢迎一起交流前端!