VUE 模板 v-if 判断 数组是否为空
vue 判断数组是否为空为空:array == undefined ||array == null || array.length <= 0 (顺序不能调换)不为空: array !==undefined &&array != null || && array.length > 0<ul v-if="commentList == undefined
·
vue 模板 v-if 判断数组是否为空 :
为空:array == undefined ||array == null || array.length <= 0 (顺序不能调换)
不为空: array !==undefined && array != null && array.length > 0 (顺序不能调换)
示例:
<ul v-if="commentList == undefined ||commentList == null || commentList.length <= 0 " >
暂无评论!
</ul>
<ul v-if="commentList != undefined && commentList != null && commentList.length > 0 " >
<li class="list-group-item" v-for="(item,index) in commentList" >
<div class="username">
{{ item.username }} 说:
</div>
<div class="content" >
{{ item.content }}
</div>
</li>
</ul>
更多推荐
已为社区贡献20条内容
所有评论(0)