el-table :cell-
//设置表格背景颜色
TableCellStyle(row: any, column: any, rowIndex: any, columnIndex: any) {
if (!row.columnIndex) {
return 'background-color: #e2e7ea';
} else {
if (row.columnIndex < 11) {
return 'background-color: #e2e7ea';
} else {
return null;
}
}
}
方案一
el-table :row-class-name="tableAddClass"
tableAddClass({row,rowIndex}) {
if (row.is_halt) {
return 'tr-red';
}
return '';
}
方案二
el-table :cell-
//设置表格背景颜色
TableCellStyle(row: any, column: any, rowIndex: any, columnIndex: any) {
if (!row.columnIndex) {
return 'color: #e2e7ea';
} else {
if (row.columnIndex < 11) {
return 'color: #e2e7ea';
} else {
return null;
}
}
}