elementUI 表格刷新后保持行高亮显示
elementUI 表格刷新后保持行高亮显示#大掌柜#
第一步:
点击行高亮时候,把该行的值,赋值到currentRow(这个可以用单击或者双击的方法度库获取到值)
第二步:
// 高亮显示
// currentRow 刷新前被点击行数据,点击高亮行时候,把该行数据赋值到currentRow字段中
// tableData 表格数据
highLightRow() {
console.log('this.currentRow1',this.currentRow,'this.currentRow2')
if (this.currentRow === null) return;
for (const item of this.tableList) {
if (item.id === this.currentRow.id) {
this.$refs.singleTable.setCurrentRow(item);
}
}
},
},
第三步:
在更新表格的数据的成功回调函数里面调用hightLightRow()方法就可以了
附带资料:el-table表格基本信息