ElementUI之表格中数据以tag标签显示(后台数据为 0 1 2,判断后显示不同类型)

如图 是表格中显示的 出租状态
在这里插入图片描述
表格中的出租状态列

<el-table-column
        prop="isRenting"
        label="出租状态"
        align="center">
    <template slot-scope="scope">
        <el-tag
                :type="scope.row.isRenting == '1' ? '' : scope.row.isRenting == '0'?'danger':'success'"
                disable-transitions>{{scope.row.isRenting == '1' ? "已出租" :scope.row.isRenting ==
            '0'?"未出租":"已预约"}}
        </el-tag>
    </template>
</el-table-column>

出租状态为1 则显示已出租 tag标签类型为默认类型
出租状态为0 则显示未出租 tag标签类型为danger
出租状态不为0和1,则显示已预约,tag标签类型success

发布了55 篇原创文章 · 获赞 14 · 访问量 6246

猜你喜欢

转载自blog.csdn.net/qq_41154522/article/details/104597120