设置table被选中项,注意三点,基本上可以解决
注意点1:rows,传的值要与选中对象项保持一致
注意点2:使用this.$nextTick(()=>{} ,节点都更新完后再触发
注意点3:this.$refs.multipleTable.toggleRowSelection()的使用写得更加详细
// 设置table被选中项
toggleSelection(rows) {
this.$nextTick(()=>{
if (rows) {
rows.forEach(row => {
this.$refs.multipleTable.toggleRowSelection(this.tableData.records.find(item => { return row.id == item.id}))
});
} else {
this.$refs.multipleTable.clearSelection();
}
})
}