- el-table设置一个row-class-name来协助获取index
<el-table :data="tableData"
:row-class-name="tableRowClassName"
tooltip-effect="light"
style="width: 100
tableRowClassName(row, index) {
row.row.index = row.rowIndex;
}
- 把获得的下标放到selectionItemIndexes里
handleSelectionChange(rows) {
this.selectionItemIndexes = [];
rows.forEach(item => {
this.selectionItemIndexes.push(item.index);
});
},
deleteData() {
this.tableData = this.tableData.filter((item, index) => {
let arrlist = this.selectionItemIndexes;
return !arrlist.includes(index);
});
}
网友评论