<scroll-view scroll-y="true" bindscrolltolower="scrollEvent" style='height:1336rpx;'>
这里有很多电影数据。。。
</scroll-view>
处理方法
刷新的个数
var offset = 0;
onLoad: function (options) {
保证每次点进去都能下拉刷新
offset = 0;
this.requests('http://localhost:8888/movies/')
},
下滑滚动事件
scrollEvent: function(event){
offset += 9;
this.requests("http://localhost:8888/movies/")
},
requests(url) {
let self = this;
wx.request({
url: url,
method: "GET",
success: function (response) {
self.setData({
movies: response.data.slice(0, offset+9) offset为刷新的个数
})
}
})
},
网友评论