(vue)element-ui 表格实现勾选单选
效果:
重选后:
<el-table
:data="tableData"
height="400" //固定高度滚动
tooltip-effect="dark"
style="width: 100%"
border
ref="multipleTable" //重点
@select="handelSelectTable" //重点
>
// 表格单勾选
handelSelectTable(selection, row) {
this.multipleSelection = row;
this.$refs.multipleTable.clearSelection(); //先清空选中状态,selection值还在
if (selection.length === 0) {
//这里状态为勾选
return;
}
this.$refs.multipleTable.toggleRowSelection(row, true); //用于切换某行选中状态
},
解决参考:https://blog.csdn.net/m0_58373910/article/details/125912828