<el-table :data="tableData" class="table" style="width: 100%; margin-bottom: 20px" row-key="id" border max-height="1050"
@row-click="onTableRow" :row-class-name="tableRowClassName">
let highLightRows = ref<any>([])
function onTableRow(row: any) {
const exists = highLightRows.value.includes(row);
if (exists) {
highLightRows.value = highLightRows.value.filter((item: any) => item !== row)
} else {
highLightRows.value.push(row)
}
}
function tableRowClassName({ row }: any) {
for (let i = 0; i < highLightRows.value.length; i++) {
if (highLightRows.value[i] == row) {
return 'highLight-row'
}
}
}
.table .el-table__body tr:hover>td {
background-color: #ffdb20 !important;
}
.el-table .highLight-row {
background: #ffdb20;
}