在el-table里有這么一個屬性row-class-name,是一個回調函數,可以給el-table__row加class。

舉個栗子:
template
<el-table :data="dataTable" border style="width: 100%" :row-class-name="tableRowClass">
script
methods: {
tableRowClass(val){
if(val.row.excessTime == '已結束'){
return 'row-bg';
}else{
return '';
}
}
}
style
<style>
.el-table .row-bg{
background: #5CB85C;
}
</style>
