el-table实现每行颜色不同

 <el-table
            ref="multipleTable"
            v-loading="loading"
            :data="orderList"
            :row-class-name="tableRowClassName"
          >

row-class-name

行的 className 的回调方法,也可以使用字符串为所有行设置一个固定的 className

 tableRowClassName({ row, rowIndex }) {
      // console.log(row);
      if (row.isRemind == 2) {
        return "warning-row";
      } else if (row.isRemind == 3) {
        return "success-row";
      } else if (row.isRemind == 4) {
        return "red-row";
      } else if (row.isRemind == 5) {
        return "yellow-row";
      } else if (row.isRemind == 1) {
        return "green-row";
      } else if (row.isRemind == 0) {
        return "yellow-row";
      }
      return "";
    },

根据每行的值,添加不同的类名,根据类名,添加不同样式

::v-deep .el-table .warning-row {
  background: rgb(226, 211, 179);
  // color:red;
}
::v-deep .el-table .success-row {
  background: pink;
  // color:green;
}
/* 红 */
::v-deep .el-table .red-row {
  background: #f30d0d4f;
  color: black;
}
/* 绿 */
::v-deep .el-table .green-row {
  background: #9cd87cd8;
  // color:green;
}
/* 黄 */
::v-deep .el-table .yellow-row {
  background: #f7f32b9d;
  color: black;
}

排序

  // 排序 
   sortreceiveTime(column, prop, order) {
      //  console.log(column.order); 
      //  return 
      if (column.order != null) {
        this.queryParams.collation = column.order;
      } else {
        this.queryParams.collation = descending;
      } 
      this.getList();    
      //ascending     升序
      //descending    降序 
      // 
    }, 

  • 7
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值