Eleement table has a built-in mouse floating discoloration function, you mouse stop in which column, which column discoloration but MY project a place need to achieve the selected function, of course, floating discoloration can not be removed
The selected
So let me go to this one, and see what function I need to add to implement radio
According to the website, I need to add two lines of code to the el-Table
highlight-current-row
@current-change="handleCurrentChange"
Copy the code
Write another method that exports the information for the selected column
// Select handleCurrentChange(val) {this.currentrow = val; },Copy the code
So that’s the way it works, but I found out
The float will overwrite the selected effect, so I studied it for a while, asked a friend and changed it
// Select highlight. El-table__body tr. Current-row > td {background: red! important; color: skyblue; }Copy the code
The key is to add one! Important, so that the selected effect takes precedence over the float and is not replaced by the float