How to implement the table component in element ui to highlight the selected row after the checkbox is selected

is similar to this selection method. I want to highlight the selected row. The most important thing is that what I want to achieve is dynamic. When I select a row, I want to highlight it

.
Apr.09,2021

my solution uses @ selection-change= "handleSelectionChange": row-style= "rowClass" . Take all the contents selected by checkbox in handleSelectionChange and save them in selectData, then monitor selectData to determine the location of selected rows in the table list, save all index in selectRow, and finally add background colors to the corresponding lines in rowClass

.
data(){
    return {
        selectRow:[],
        selectData:[]
    }
},
  methods: {
    // 
    handleSelectionChange(data) {
      this.selectData = data;
    },
    // 
    rowClass({row, rowIndex}){
      if(this.selectRow.includes(rowIndex)){
        return { "background-color": "rgba(185, 221, 249, 0.75)" }
      }
    }
  },
watch: {
    selectData(data) {
      this.selectRow = [];
      if (data.length > 0) {  
        data.forEach((item, index) => {
          this.selectRow.push(this.tableData.indexOf(item));
        });
      }
    }
}

clipboard.png
row-class-name usage of table, calculate the className of the selected row based on selection

listening for SelectionChange events, modifying the selection array,
and then redrawing the chart with doLayout should be feasible

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1ea2a3f-1bec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1ea2a3f-1bec.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?