背景
根据列表信息,将表格的行或者列,或者单元格高亮(格式化)
实现
<el-table
:data="failedTableDatas"
border
stripe
tooltip-effect="dark"
:cell-style="setTableCellStyle"
@selection-change="handleSelectionChange"
>
...............
..............
</el-table>
// 高亮错误信息
setTableCellStyle({
row, column, rowIndex, columnIndex
}) {
const checkErrorInfo = this.resultinfo.checkResultInfoMap
if (checkErrorInfo.hasOwnProperty(`${rowIndex + (this.failedCurrentPage - 1) * this.failedPageSize}@${columnIndex}`)) {
if (row[column.property] != null) {
return 'font-weight:700;color:red '
}
return 'background:#DDDDDD'
}
return ''
}