<el-table :row-class-name="tableRowClassName"></el-table>
tableRowClassName({row,rowIndex }) {
row.index = rowIndex
let styleColor = ''
if((row.companyName && row.companyName.includes('汇总'))|| (row.productName && row.productName.includes('汇总'))) {
styleColor = 'tr-red fixed-row' //重要
}
if ((rowIndex + 1) % 2 === 0) {
return `success-row ${styleColor}`
} else {
return `warning-row ${styleColor}`
}
},
/deep/.el-table .fixed-row{
display: table-row;
position: sticky;
bottom: 0;
width: 100%;
td {
border: 1px solid #f3f5fa;
background: #fff;
}
}
表格内容保留空格
/deep/.el-table .cell {
white-space: pre !important;
}