element-ui根据表格数据的值,设置单元格的颜色 人五人六 发表于2022/7/21 18:07 617浏览 0评论 5分钟阅读 需求:对表格中为0 的单元格进行标红处理 解决:cell-class-name html: <el-table border ref="saleBill" :data="saleBill" :cell-class-name="cellClassName"> </el-table>Copy 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' } }Copy CSS: .zeroClass{ color: red; font-weight: bold; }Copy 标签:#Element#vue