需求:对表格中为0 的单元格进行标红处理
解决:cell-class-name
html:
<el-table border
ref="saleBill"
:data="saleBill"
:cell-class-name="cellClassName">
</el-table>
Js:
//methods
cellClassName({row, column, rowIndex, columnIndex}){
if((column.property == 'pack_dj' || column.property == 'pack_sl' || column.property == 'pack_order_sl') && row[column.property] <= 0 ){
return 'zeroClass'
}
}
CSS:
.zeroClass{
color: red;
font-weight: bold;
}