表格的字体颜色动态变化
在表格标签加上::cell-style="cellStyle"
再定义方法
cellStyle({ row, column, rowIndex, columnIndex }) {
// 状态列字体颜色
if (column.label === '状态' && row.statusName === '正常') {
return 'color: #67C23A'
} else if (column.label === '状态' && row.statusName === '停用') {
return 'color: #F56C6C'
} else {
return ''
}
},
row为某一行的除操作外的全部数据
column为某一列的属性
rowIndex为某一行(从0开始数起)
columnIndex为某一列(从0开始数起)