实现效果:
实现:添加:row-style
,动态绑定方法tableRowClassName
<el-table
ref="sortTable"
:height="sortTableHeight"
style="width: 100%;"
border
:row-style="tableRowClassName"
:stripe="false"
:header-cell-style="{background: '#EBEEF5',border: '0px solid #DDDDDD',height: '10px',color:'#2B579A'}"
:data="tableData">
</el-table>
方法:
tableRowClassName({row, rowIndex}) {
let styleJson = {
'background-color': '#ECF5FF'
}
if ((rowIndex & 1) === 1) {
return styleJson
}
return ''
},