1. 程式人生 > >element table(任意td改變背景顏色cell-class-name)

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;
}