//elementui 2.x 版本的写法
html部分
<el-table :data="tableData" border style="width: 100%" :header-cell-style="getRowClass">
方法
//设置表格第一行的颜色
getRowClass({ row, column, rowIndex, columnIndex }) {
if (rowIndex == 0) {
return 'background:yellow'
} else {
return ''
}
//elementui 1.x版本的修改方法:
//html
<el-table :key='tableKey' :data="list" border fit highlight-current-row style="width: 100%;" class="el-tableee"></el-table>
//style
<style scoped="scoped">
.el-tableee >>> .el-table__header-wrapper thead div,.el-tableee >>> th, .el-tableee >>> .el-table__fixed-header-wrapper thead div {
background:yellow;
}
</style>
![]()