swiper 组件的高度设置问题

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中动态设置

原文地址:https://www.cnblogs.com/Mvloveyouforever/p/9635326.html