小程序上拉加载更多,onReachBottom
onReachBottom: function () {
console.log(1)
var that = this;
var path = ‘/listsearch/‘;
var datalist=null;
var url = app.globalData.http_base_url + path;
// 显示加载图标
wx.showLoading({
title: ‘玩命加载中‘,
})
app.globalData.currentPage ++;
var _currentPage = app.globalData.currentPage;
if(that.data.yearselect==undefined){
var selectyear="None"
}else{
var selectyear=that.data.yearselect
}
wx.request({
url:url,
data:{
searchdetail:that.data.SearchContent,
years:selectyear,
page:_currentPage
},
method:‘GET‘,
success:function(res){
console.log(res)
if(res.data.carbonlist.length==0){
wx.showLoading({
title: ‘暂无更多数据‘,
})
}else{
for (var i = 0; i < res.data.carbonlist.length; i++) {
that.data.carbonlist.push(res.data.carbonlist[i]);
}
console.log(that.data.carbonlist)
const pushData=that.data.carbonlist
// 设置数据
that.setData({
carbonlist: pushData
})
// 隐藏加载框
}
wx.hideLoading();
}
})
},