行业知识
【前端vue+elemenui】el-table根据表格数据设置整行样式或单元格样式
2026-11-16 02:44:14
来源:互联网转载
首先需要了解俩个函数,row-class-name、cell-class-name
这里以cell-class-name单元格样式为例
| row-class-name | 行的 className 的回调方法,也可以使用字符串为所有行设置一个固定的 className。 | Function({row, rowIndex})/String |
| cell-class-name | 单元格的 className 的回调方法,也可以使用字符串为所有单元格设置一个固定的 className。 | Function({row, column, rowIndex, columnIndex})/String |
{ item.opinion }}
--> {{ item.Time }}
// 修改样式 tableCellClassName(cel) { // 行中数据满足某个条件时class设置为bordertop if (cel.row.isBorder) { return 'bordertop' } else { return 'zcbordertop' } } ::v-deep .bordertop{ border-top: 2px solid #409EFF; text-align: center; padding: 7px 0px;}::v-deep .zcbordertop{ text-align: center; padding: 7px 0px;}
上一篇:服务器销售经历怎么写?
下一篇:逆战怎么改服务器配置?