vue+elementui table表格点击单元格单元格改变背景色

:data="tableData"
border
@cell-click="cellclick"
:cell-style="tableCellStyle">

data(){
row:'',
column:''
}

cellclick (row, column, cell, event) {
this.row = row
this.column = column
},
tableCellStyle (row, rowIndex, column) {
if (this.row && this.columnName) {}
if (this.row === row.row && this.column === row.column) {
return 'background-color:#ccc;'
} else {
return 'background-color:#fff;'
}
},

来源

你可能感兴趣的:(vue+elementui table表格点击单元格单元格改变背景色)