ElementUI改变表格颜色的方法 -- cell-class-name

  • 话不多说直接代码:

      
      
      
      
      
      
 
 methods: {
      changeCellStyle({row, column, rowIndex, columnIndex}) {
      //第八列添加 red 类
        if(columnIndex == 7){
          return 'red'
        }
        //某一行其中的一个变量applies值如果大于0,并且在第六列,即确定一个具体的单元格需要确定行和列
        if(parseFloat(row.applies) >0 && columnIndex == 5){
          return 'red'
        }
       }
      }

你可能感兴趣的:(ElementUI改变表格颜色的方法 -- cell-class-name)