element ui表格实现单选 但是单选取消会报错
1.在el-table中添加两个事件
@selection-change="handleSelectionChange"
@current-change="choosperssionChange"
ref="Table"
2.然后在methods定义两个方法
// 点击表格中复选框拿到哪一行想要的数据
handleSelectionChange(val) {
if (val.length > 1) {
this.$refs.Table.clearSelection();
this.$refs.Table.toggleRowSelection(val.pop());
} else{
//拿到想要的id什么的
}
},
// 切换到某一行的状态
choosperssionChange(val) {
this.$refs.Table.toggleRowSelection(val);
},
3.这是我遇到的错误,因为我点击复选框,在点击一次会报错,以下是报错信息



浙公网安备 33010602011771号