- 比如我们这里需要展示一个拥有三个值的数据,当
direction = 0
时展示未知
,direction = 1
时展示上行
,direction = 2
时展示下行
就可以像下面这样写
<el-table-column align="center" label="方向" prop="direction">
<template slot-scope="scope">
<span>{{scope.row.direction === 1 ? "上行" : (scope.row.direction === 2 ? "下行" : "未知")}}</span>
</template>
</el-table-column>