elementUI 表格刷新后保持行高亮显示
重点是知道setCurrentRow属性 this.$refs.filedNameTable.setCurrentRow(row)
<el-table v-loading="tableDataLoading" highlight-current-row :data="tableData" ref="filedNameTable" >
// 高亮显示
// currentRow 刷新前被点击行数据
// tableData 表格数据
highLightRow() {
if (this.currentRow === null) return
for (const item of this.tableData) {
if (item.tabName === this.currentRow.tabName) {
this.$refs.filedNameTable.setCurrentRow(item)
}
}
},
在更新表格的数据的成功回调函数里面调用hightLightRow()
方法就可以了