有时候后台返回的状态不是中文的时候而是1、2、3这种类型的时候这时候不能直接根据prop属性直接进行显示,需要根据这些类型进行判断从而显示我们想要的中文时,比如表格中的某列需要显示中文的时候:

<el-table-column width="100" label="商品状态" align="center">
    <template slot-scope="scope">
       <el-tag type="success" effect="dark" v-if="scope.row.status==1">在售</el-tag>
       <el-tag type="warning" effect="dark" v-if="scope.row.status==2">下架</el-tag>
       <el-tag type="danger" effect="dark" v-if="scope.row.status==3">删除</el-tag>
    </template>
</el-table-column>

 

相关文章:

  • 2021-06-22
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-30
  • 2022-12-23
  • 2021-12-27
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案