1.效果一览
2.实现思想:
使用作用域插槽:slot-scope="scope";绑定class类'back';v-if条件判断:如果scope.row.xh == 1,2,3 ,则给他绑定类,设置样式。不满足条件的则不绑定类,不设置样式。
3.实现代码:
html代码:
<el-table-column prop="xh" label="序号" width="80" align="center">
<template slot-scope="scope">
<i
v-if="scope.row.xh =='1' || scope.row.xh =='2' || scope.row.xh =='3'"
:class="{back:isBack}">
{
{scope.row.xh}}
</i>
<i v-else></i>{
{scope.row.xh}}
</template>
</el-table-column><