方法一
在el-table设置属性cell-style方法
<el-table
:cell-style="setRowStyle">
  .........
</el-table>
在method中设置
setRowStyle(row, column, rowIndex, columnIndex) {
   if(row.status=== "1"){
       return 'color: green' 
   }else{
       return 'color: red' 
   }
}
方法二
<el-table-column prop="status" label="状态">
    <template scope="scope">
        <span v-if="scope.row.status==='1'" style="color: green">成功</span>
        <span v-else-if="scope.row.status==='2'">失败</span>
        <span v-else style="color: red">未知</span>
    </template>
</el-table-column>
Logo

前往低代码交流专区

更多推荐