小程序swiper高度自适应解决方案

scroll-view 里面继续套一个 scroll-view ,设置纵向允许滚动

<swiper class="swiper">

        <swiper-item>

              <scroll-view scroll-y="true" class="scroll">

              <!-- 这里是内容 -->

              </scroll-view>

        </swiper-item>

</swiper>

 

css中高度设置为100%

 

.swiper{height: calc(100vh - 120px);}

.scroll{ height: 100%;}

 

参考来源:https://blog.csdn.net/qq_38499671/article/details/111994400

posted @ 2021-12-02 15:09  宅女二二  阅读(194)  评论(0)    收藏  举报