![](https://i-blog.csdnimg.cn/blog_migrate/e5ccba083d5702bad73a84bf95148ee7.png)
- 头部颜色: :header-cell-style="getRowClass"
- 单元格颜色: :cell-style="styleBack"
<el-table
:model="form"
:cell-style="styleBack"
:header-cell-style="getRowClass"
label-width="800px" />
// 表格奇偶层样式
styleBack({ row, column, rowIndex, columnIndex }) {
if ((rowIndex + 1) % 2 === 0) {
return "background:#053c4a; color:#fff;border:1px solid #053c4a";
} else {
return "background:#042831; color:#fff;border:1px solid #042831";
}
},
// 表头样式
getRowClass({ rowIndex }) {
return "background:#053c4a; color:#fff;border:3px solid #053c4a";
},