swiper 组件的高度设置问题

2023-02-16,,,

1、swiper组件直接运用时, .content>swiper{height:100%} 是不起作用的。

正确的做法是:

  

swiper{
height: 100vh;
} // 或者 <swiper style="height:calc(100vh - {{titleBarHeight+statusBarHeight}}px)" vertical="{{false}}" >
<block wx:for="{{weeks}}">
<swiper-item>
<view class='testItem' >
<label wx:for="{{ceils}}" >{{item}}</label>
</view>
</swiper-item>
</block>
</swiper>

注:也就是说 必须只能用 标签选择器去设置样式,而且设置尺寸的值不能是百分比,必须是具体的高度。或者 在mxml的style中动态设置

swiper 组件的高度设置问题的相关教程结束。

《swiper 组件的高度设置问题.doc》

下载本文的Word格式文档,以方便收藏与打印。