效果图:
先添加两个事件:
然后需要保存行和列的信息,然后在 tableCellStyl对象里判断,等于哪一行哪一行就变色,否则就是白色
cellclick(row, column) {
this.row = row;
this.column = column;
},
tableCellStyle(row) {
if (
this.row === row.row
) {
return "background-color:#f7f9fa;";
} else {
return "background-color:#fff;";
}
},