项目场景:
根据后端返回的数据,在前端表格判断进行展示。
问题描述
![在这里插入图片描述](https://img-blog.csdnimg.cn/6955e6b737534891a13876fbae363d0e.png)
后段返回空数据后前端表格中不展示
解决方案:
<el-table-column label="派送人" align="center" prop="userName" >
<template slot-scope="scope">
<span v-if="scope.row.userName == ''">无</span>
<span v-if="scope.row.userName != ''">{{scope.row.userName}}</span>
</template>
</el-table-column>
![判断并展示无](https://img-blog.csdnimg.cn/562c5921f7ee46ef928e5a4050e5b74b.png)