el-table的 :cell-style用法
实现表格固定行文字高亮效果
<el-table
ref="table"
border
stripe
:data="list"
:height="height"
highlight-current-row
:cell-style="cellStyle"
>
<el-table-column
prop="code"
label="规则编码"
:min-width="120"
show-overflow-tooltip
>
<template slot-scope="{ row }">
<el-popover
v-show="row.error"
placement="top"
trigger="hover"
content="规则异常"
>
<i slot="reference" class="remark-icon el-icon-warning-outline" />
</el-popover>
{{ row.code}}
</template>
</el-table-column>
</el-table>
cellStyle({ rowIndex }) {
const rowsToHighlight = []
this.list.forEach((item, index) => {
if (item.error) {
rowsToHighlight.push(index)
}
})
if (rowsToHighlight.includes(rowIndex)) {
return 'color: #F59A23;'
}
return ''
},