直接上代码
xml
<swiper current="{{currentData}}" class='swiper' style="height:{{winHeight}}px" duration="300" bindchange="bindchange">
<!--第一个页面-->
<swiper-item style="height:100%;">
<scroll-view style="height:400px;" scroll-y='true'>
<!--这里是你的循环体-->
</scroll-view>
</swiper-item>
<!--第二个页面-->
<swiper-item style="height:100%;">
<scroll-view style="height:400px;" scroll-y='true'>
<!--这里是你的循环体-->
</scroll-view>
</swiper-item>
js
onLoad: function () {
var that = this;
wx.getSystemInfo({
success: function (res) {
that.setData({
winWidth: res.windowWidth,//获取系统的长
winHeight: res.windowHeight//获取系统的高
});
}
});
},
//然后再Data里面加入
winWidth: 0,
winHeight: 0,
就OK了