question1: el-table 中 根据数据不同 动态添加 class
要注意的是: scope.row.变量
,不是 scope.变量
, 多了 一个 row
<el-table> <el-table-column prop="subject_state" label="备案状态" align="center" width="180" > <template slot-scope="scope"> <span :class="[ scope.row.subject_state == '未核实' ? 'orange' : '', scope.row.subject_state == '进行中' ? 'blue' : '', scope.row.subject_state == '已完成' ? 'green' : '', scope.row.subject_state == '未整改' ? 'red' : '', scope.row.subject_state == '已注销' ? 'pink' : '', ]" > {{ scope.row.subject_state }} </span> </template> </el-table-column> </el-table>