0
点赞
收藏
分享

微信扫一扫

关于element ui 表格文字高亮(单元格的cell-style)使用方法

萍儿的小确幸 2022-03-22 阅读 49

1、官网解释:单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有单元格设置一样的 Style。

Function({row, column, rowIndex, columnIndex})/Object

2、实际我添加 column, rowIndex, columnIndex参数后报错 问题不知道出哪儿了,然后就没用它
这样就行了

 <el-table height="90%" :data="dmData" :cell-style="cellStyle">
              <el-table-column
                prop="xh"
                label="序号" min-width="5%">
              </el-table-column>
              <el-table-column
                prop="xm"
                label="姓名" min-width="8%">
              </el-table-column>
              <el-table-column
                prop="gh"
                label="工号" min-width="18%">
              </el-table-column>
              <el-table-column
                prop="kqzt"
                label="考勤状态" min-width="18%">
              </el-table-column>
              <el-table-column
                prop="bz"
                label="备注" min-width="25%">
                <template>
                  <el-button type="text" class="ckBtn btn">查看</el-button>
                </template>
              </el-table-column>
              <el-table-column
                prop="cz"
                label="操作" min-width="18%">
                <template>
                  <el-button type="text" class="chBtn btn">撤回</el-button>
                </template>
              </el-table-column>
            </el-table>
    cellStyle(row){
      if(row.column.label==="考勤状态" && row.row.kqzt==="请假"){
        return 'color:#ffc000'
      }
    }

在这里插入图片描述

举报

相关推荐

0 条评论