element-UI使用el-table根据后台数据判断状态
效果图如下
实现代码如下:
<el-table-column fixed="right" prop="isPowerCut" label="停电状态" width="80">
<template scope="scope">
<el-button type="text" style="color:red" v-show="scope.row.isPowerCut===0">未停电</el-button>
<el-button type="text" style="color:green" v-show="scope.row.isPowerCut===1">已停电</el-button>
<el-button type="text" v-show="scope.row.isPowerCut===2">延期送电</el-button>
<el-button type="text" style="color:#808080" v-show="scope.row.isPowerCut==null ? true : false">未操作</el-button>
</template>
</el-table-column>