一、在data中定义状态数组集合
statusOptions:[
{
label:"草稿",
value:0
},
{
label:"公司管理员审批",
value:1
},
{
label:"审批通过",
value:2
},
{
label:"退回",
value:3
}
]
二、对定义的状态数组集合进行循环判断
<el-table-column label="状态" width="150" prop="" align="center">
<template slot-scope="scope">
<div v-for="item in statusOptions" :key="item.value">
<span :class="scope.row.status == 3 ? 'back' : 'pass'" v-if="item.value == scope.row.status">{{item.label}}</span>
</div>
</template>
</el-table-column>
三、在style中定义class样式
.back {
color: #f00;
}
.pass {
color: #149d51;
}
四、展示效果