小程序分页
onShow: function() {
this.data.page = 1;
this.data.aa = [];
this.inquiryplace();
}
onReachBottom: function() {
var that = this
console.log(that.data.item.length)
if (that.data.aa.length == that.data.page * 15) {
that.data.page = that.data.page + 1
this.inquiryplace();
}
},
inquiryplace: function() {
var thit = this;
var userid = app.globalData.id;
var token = app.globalData.token;
var page = this.data.page;
wx.request({
url: website + 'getsite',
method: 'POST',
data: {
userid: userid,
page: page,
},
header: {
'token': token,
'content-type': 'application/json'
},
success: (res) => {
console.log(res.data)
if (item != null) {
for (let i = 0; i < item.length; i++) {
this.data.aa.push(item[i]);
}
}
thit.setData({
item: this.data.aa,
boolean: boolean
})
}
}
})
},