The el-table table in elementui sets the cell background color according to different values

el-table in elementui sets cell background color based on different values

//1.需要在表头设置cell-class-name
//单元格的 className 的回调方法,也可以使用字符串为所有单元格设置一个固定的 className。
//Function({row, column, rowIndex, columnIndex})/String
<el-table
    :data="tableData"
    :cell-class-name="myclass"
    style="width: 100%"
>
/修改单元格样式的方法
myclass({
     
     row,column,rowIndex,columnIndex}){
    
    
   if(columnIndex ==0||columnIndex ==0){
    
    
          return 'setclass';
   }
},
    .setclass{
    
    
        background: rgba(26, 160, 148, 0.05);;
    }

Guess you like

Origin blog.csdn.net/weixin_45506717/article/details/124322173