表格字体变色

∥☆過路亽.° 提交于 2019-12-01 21:50:01

最近项目需要使表格字体变色,具体需求如下:

 

 在表格中,分为2类,需要处理。

1、 template slot-scope="scope"

2、 直接写在label上的。el-table-column label="证件名称" 

解决方法:

第一类、 简单粗暴的直接 v-if去判断

 <template slot-scope="scope">
                <font v-if="scope.row.certificateStatus === 2">通过</font>
                <font v-else-if="scope.row.certificateStatus === 1"  color="red">待审核</font>
                <font v-else="scope.row.certificateStatus === 3" color="red">驳回</font>
              </template>

第二类:

1、 在el-table加上:cell-style="cellStyle"。

2、 然后判断label

 

 <el-tab :cell-style="cellStyle"></el-tab>

  cellStyle(row, column, rowIndex, columnIndex) {
      console.log(row);
      if (
        row.column.label == "完美状态" &&
        row.row.certificateStatus == "1"
      ) {
        return "color:red";
      }
    }

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!