先放样式图
在同一表格内,实现多选框和单选框的切换,用的组件是iview。
代码截图
源码:
this.columnsVideo.splice(0, 1, { //this.columnsVideo是表格列
type: "selection",
width: 60,
tooltip: true,
align: "center"
})
this.columnsVideo.splice(0, 1, {
type: 'radio',
title: '',
align: 'left',
render: (h, params) => {
let flag = this.radioId === params.row.id
return h('Radio', {
props: {
value: flag
},
on: {
input: () => {
this.radioId = params.row.id
this.radioChose = params.row;
}
}
})
}
})