動態綁定height: v-if、v-else例: ...
動態綁定height:
:style="{height: slideHeight+'rem'}"
slideHeight: 2
如果需要計算來得到高度,如:
<p :style="obj">111</p>
data:
winHei: screen.availHeight, //屏幕高度 winWid: screen.availWidth, //屏幕寬度 obj:{ height : '' }
this.obj.height = winHei * 3 +'px';
v-if、v-else
例:
<div v-if="isShowSlide" class="shopSlideImg" style="height:2rem"> <shop-slide :shopImgsList="shopImgsList"></shop-slide> </div> <div v-else="isShowSlide" class="shopSlideImg" style="height:0rem"> <shop-slide :shopImgsList="shopImgsList"></shop-slide> </div>