小程序swiper-item內容過多顯示不全的解決方案

最近在項目遇到swiper高度不能自適應,致使swiper-item 裏面的內容過多時只能顯示一部分,最終解決方案:
<swiper current="{{currentTab}}" style="height: {{clientHeight?clientHeight+'px':'auto'}}"> <swiper-item> <scroll-view scroll-y="{{true}}" style="height: {{clientHeight?clientHeight+'px':'auto'}}" bindscrolltolower="scrollbot"> 內容放在這 </scroll-view> </swiper-item> </swiper>
swiper-item { overflow: scroll; }

最後在後臺動態得到屏幕可視區域高度clientHeight便可this

 onLoad: function () { var that = this wx.getSystemInfo({ success: function (res) { that.setData({ clientHeight: res.windowHeight-177 }); } }) }
相關文章
相關標籤/搜索