//类home-data的盒子内容不确定高度,动态设置swiper的高度展示完全swiper里面的内容,也就是类home-data的盒子内容
let view = uni.createSelectorQuery().select(".home-data");
view.boundingClientRect(data => {
this.clentHeight = data.height;
}).exec();
<swiper @change='onChangeTab' :current="topBarIndex" :style="'height:'+clentHeight+'px;'">
<swiper-item
v-for='(item,index) in topBar'
:key='index'
>
<view class='home-data'>
<Banner></Banner>
<Icons></Icons>
<Card cardTitle='热销爆品'></Card>
<Hot></Hot>
<Card cardTitle='推荐店铺'></Card>
<Shop></Shop>
<Card cardTitle='为您推荐'></Card>
<CommodityList></CommodityList>
</view>
</swiper-item>
</swiper>