element plus 表格,单元格颜色,边框设置

先看效果
在这里插入图片描述

:cell-style="cellStyle"设置单元格颜色,边框,返回值一定是个对象包含

<el-table
        border
        v-loading="loading"
        :data="items"
        :cell-style="cellStyle"
        style="width: 100%; max-height: 600px; white-space: nowrap"
        :default-sort="{ prop: 'fareaid', order: 'ascending' }"
      ></el-table>

css配置

// 单元格边框颜色
const cellStyle = ({ column }) => {
  if (
    ["填报工时", "任务进度(%)", "工作内容", "产出文档提交情况"].includes(
      column.label
    )
  ) {
    return {
      borderTop: "1px solid #007bff",
      borderBottom: "1px solid #007bff"
    };
  }
};

或者

const cellStyle = ({ row, column, rowIndex, columnIndex }) => {
  // 状态列字体颜色
  if (columnIndex === 0 && row.fused) {
    return { backgroundColor: "#409eff" };
  }
};
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值