vue的v-if和v-else-if判断的应用
<div class="car_gl"><div v-for="gl in Article"><div class="new_box1 clearfix" v-if="gl.images.length==1"><div class="box1_left"><p>{{gl.title
·
<div class="car_gl">
<div v-for="gl in Article">
<div class="new_box1 clearfix" v-if="gl.images.length==1">
<div class="box1_left">
<p>{{gl.title}}</p>
<div class="box1_zuozhe clearfix">
<span>{{gl.createtime}}</span>
<i>{{gl.read_num}}次浏览</i>
</div>
</div>
<img class="box1_img" :src="gl.images" alt="" />
<a :href="'../strategy/strategyDetail.html?id='+gl.id"></a>
</div>
<div class="new_box2 clearfix" v-else-if="gl.images.length==3">
<p>{{gl.title}}</p>
<div class="img_box2">
<img v-for="image in gl.images" :src="image">
</div>
<div class="box2_zuozhe clearfix">
<i>{{gl.createtime}}</i>
<strong>{{gl.read_num}}人已阅读</strong>
</div>
<a href="#"></a>
</div>
</div>
</div>
判断文章中含有几张图片,来显示相应的结构
更多推荐
已为社区贡献5条内容
所有评论(0)