element-ui prop 三元运算符

317 阅读1分钟

本文已参与「新人创作礼」活动, 一起开启掘金创作之路。 ​

 代码

<el-table-column label="是否公开">
  <template slot-scope="scope">
    <span>{{scope.row.is_open== 1 ? '是' :'否'}}</span>
  </template>
</el-table-column>

效果:

​编辑

用 v-if

<el-table-column label="是否公开">
  <template slot-scope="scope">
    <span v-if="scope.row.is_open== 1"></span>
    <span v-else></span>
  </template>
</el-table-column>

​编辑

\