data() {
return {
arr: []
}
}
{
title: '选择',
align: 'center',
width: '80',
render: (h, params) => {
this.arr.push(params.row)
return h('div', [
// iview 的 Checkbox组件
h('Checkbox', {
props: {
value: params.row.checked
},
on: {
'on-change': (e) => {
this.arr.forEach(items => {
//先取消所有对象的勾选,checkBox设置为false
this.$set(items, 'checked', false)
})
//再将勾选的对象的checkBox设置为true
this.arr[params.index].checked = e
// 下面均为所选中此行的信息
let jsonStr = this.arr[params.index].info;
let planForm = JSON.parse(jsonStr)
this.choosedTemp(planForm, this.arr[params.index].timeType)
}
}
})
])
}
}
iview Table 实现单选
最新推荐文章于 2023-06-15 18:28:12 发布