elementui中 table表格根据不同的值设置单元格背景色

1,111 阅读1分钟
<el-table
    v-loading="loading"
    :data="lists"
    border
    :cell-class-name="addClass"
    style="width: 100%"
>
 
.cell-grey{
    background: #f2f2f2;
}
addClass({row,column,rowIndex,columnIndex}){
    if(columnIndex === 5){
      if(row.goodsname == '测试'){
          return 'cell-grey';
      }
   }
}