vue el-table 点击单元格有背景色,点击第二个单元格,第一个单元格背景色消失

<el-table
      :data="tableData"
      border
      @cell-click="cellclick"
      :cell-style="tableCellStyle">
</el-table>
data(){
  row:'',
  column:''
}
cellclick (row, column, cell, event) {
  this.row = row
  this.column = column
},

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

 

posted @ 2022-07-14 19:34  Harry宗  阅读(530)  评论(0)    收藏  举报