The multiple selection event of the table in element, how to select the row and change the color of the row?

clipboard.png
when I select these pieces of data, the color of these lines changes, and when canceled, the color returns to normal. Add a highlight to the table. In the multi-selection event @ select-change= "selectChange"
selectChange: function (val) {
this.currentRow = val
}
, it has nothing to do with the multi-selection event. Only when you click on this line, the highlight occurs.
just found that the highlight is for the current row. If you don"t need the highlight, how to achieve the color change for the multi-selection and multi-line?

Mar.19,2021

https://jsfiddle.net/L5do6L3k.


add style-related code to the click event of the check box:

classclass 

use row-style or row-class-name to add styles to selected lines

  <el-table
    ref="table"
    :data="tableData"
    border
    :row-style="selectedHighlight"
    @selection-change="handleSelectionChange"
  >
  methods: {
    selectedHighlight(row) {
      if ( /*row is selected*/ ) {
        return {
          "background-color": "black"
        };
        return {}
      }
    },

see element document


because you reset every time


the problem of the landlord is solved; I have the same needs as you

Menu