element table(任意td改变背景颜色cell-class-name)

<el-table class='mt10' type="selection" :data="tableData" border ref="dataTable" :cell-class-name="rowClass">
rowClass ({ row, column, rowIndex, columnIndex }) {
  if (rowIndex === 5 && columnIndex === 4) {
    return 'rgb196'
  } else if (rowIndex === 6 && columnIndex === 4) {
    return 'bacColorf4984e'
  } else if (rowIndex === 6 && columnIndex === 5) {
    return 'bacColor317eb0'
  }
}
.rgb196{
  background: rgb(196,196,196);
}
.bacColor317eb0{
  background: #317eb0;
}
.bacColorf4984e{
  background: #f4984e;
}

猜你喜欢

转载自blog.csdn.net/qq_39237755/article/details/81252346