iview 将table的selection多选变单选方法

相信不少使用iview的朋友,在用到table,都会遇到须要使用selection的场景,可是总会有那么一个产品汪,以为iview的单选效果很差,非要用selection的来作单选,那么下面这个方法就能解决这个问题:{    title: '选中',    align:'center',    key: 'checkBox',    render:(h,params)=>{        return h('div',[            h('Checkbox',{                props:{                    value:params.row.checkBox                },                on:{                    'on-change':(e)=>{                        console.log(e)                        this.tableData.forEach((items)=>{      //先取消全部对象的勾选,checkBox设置为false                            this.$set(items,'checkBox',false)                        });                        this.tableData[params.index].checkBox = e;  //再将勾选的对象的checkBox设置为true                    }                }            })        ])    }},
相关文章
相关标签/搜索