Element 表格table,选中状态切换与会显示数据
// 回显选中的数据
selectData () {
this.rowSelectFlag = true
const idList = this.tableSelect.map((e) => e.id)
this.dataList.forEach((row) => {
if (idList.includes(row.id)) {
this.$refs.multipleTable.toggleRowSelection(row, true)
}
})
this.rowSelectFlag = false
},
//this.tableSelect 为选中数据, this.dataList为表格数据,一定得再this.dataList数据请求回来去执行selectData 函数
//清除选中状态
this.$refs.multipleTable.clearSelection();
//切换选中
toggleSelection(rows) {
if (rows) {
rows.forEach(row=> {
this.$refs.multipleTable.toggleRowSelection(row);
});
} else {
this.$refs.multipleTable.clearSelection();
}
},
//rows 选中数组