el-table中奇偶行背景色显示不同的颜色
2022-09-06 22:53:13


默认样式

el-table中奇偶行背景色显示不同的颜色_背景色


深色主题

el-table中奇偶行背景色显示不同的颜色_背景色_02

el-table中奇偶行背景色显示不同的颜色_css_03

border
ref="singleTable"
highlight-current-row
@current-change="handleCurrentChange"
:row-class-name="tableRowClassName"
:header-cell-style="{background:'#004d8c',color:'#FFFFFF'}"

事件方法

(row) {
this.$refs.singleTable.setCurrentRow(row);
},
handleCurrentChange(val) {
this.currentRow = val;
},
tableRowClassName({row, rowIndex}) {
if ((rowIndex + 1) % 2 === 0) {
return 'success-row';
}
return '';
},

样式

<style>
.el-table .success-row {
background: #DFEAF5;
}
</style>

el-table中奇偶行背景色显示不同的颜色_f5_04


本文摘自 :https://blog.51cto.com/g


更多科技新闻 ......