一、row-class-name
<el-table :row-class-name="tableRowClassName">
二、写方法
tableRowClassName ({row, rowIndex}) {
// 设置斑马线颜色
if (rowIndex % 2) {
return 'grey-bg'
} else {
return 'white-bg'
}
},
三、表格斑马线样式
.el-table .el-table__body tr.el-table__row.grey-bg td{
background: #eaeaea;
}
.el-table .el-table__body tr.el-table__row.white-bg td{
background: #fff;
}