element-plus 的 Table

17 阅读1分钟

1.按照条件标红特定一行与按照条件标红特定单元格

image.png

image.png

//column+row两个属性一起使用,才可以定位具体的单元格
const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
  if (column.property === "statusName" && row.statusName === "失败") {
    return {
      color: "#F56c6c"
    };
  }
};
//只用行row.statusName === "失败",判断是整行标红
const cellStyle1 = ({ row: { statusName } }) => {
  if (statusName === "失败") {
    return {
      color: "#F56c6c"
    };
  }
};

样式展示:

image.png

image.png