错误示范:

1.直接setCurrentRow失败(this.currentRow是之前保存的表格当前选中行的数据)

this.$refs.table.setCurrentRow(this.currentRow);

2.以为是表格没生成就执行了setCurrentRow导致设置不成功,所以使用了this.$nextTick,依旧失败

this.$nextTick(() => {
	this.$refs.table.setCurrentRow(this.currentRow);
});

最后解决:

好吧,最后发现问题出在setCurrentRow的参数上,不管你有没有改动表格数据,用你需要选中的行id,去遍历表格数据,遍历到item.id===id,则row =item,最后用this.$refs.table.setCurrentRow(row)可以解决。
完整代码如下:

this.$nextTick(() => {
	let currentRow = this.tableData.filter(item => {
		return item.id === this.currentRowId;
	});
	console.log("有选中行", currentRow[0]);
	this.$refs.table.setCurrentRow(currentRow[0]);
});

这个nextTick因为写了就没去掉,不包可能也行吧。
这是之前参数的由来:
问题:vue2+elementui,tabs切换显示表格并设置表格选中行高亮失败-LMLPHP

参考:

问题:vue2+elementui,tabs切换显示表格并设置表格选中行高亮失败-LMLPHP

11-22 15:33