onLoad: function (options) {
var url=getApp().globalData.url+'/article';
var _that=this;
wx.request({
url: url,
success:function(res){
var list=res.data.data.data.data
var cpage=res.data.data.data.current_page
var lpage=res.data.data.data.last_page
console.log(res)
_that.setData({
arr:list,
cpage,
lpage
})
}
})
},
onReachBottom: function () {
var next_page=this.data.cpage+1;
var lpage=this.data.lpage;
var url=getApp().globalData.url+'/article?page='+next_page;
var _that=this;
wx.request({
url: url,
success:function(res){
var list=res.data.data.data.data
list.forEach(function(v,k){
_that.data.arr.push(v)
});
_that.setData({
arr:_that.data.arr,
cpage:next_page
})
if(next_page>lpage){
wx.showToast({
title: '您已经滑到底了',
})
}
}
})
},