微信小程序上滑加载更多

时间:2023-03-10 02:43:24
微信小程序上滑加载更多
 onReachBottom: function () {
var that = this
var limit = that.data.limit
var count = that.data.count if(count>limit){
limit = limit + 5
}else{
wx.showToast({
title: '没有更多',
icon: 'none',
duration: 2000
})
return false
} wx.showLoading({
title: '加载中',
})
http.ajax({
url: app.globalData.orderUrl + 'order/order_status',
data: {
},
success: function (res) { if (res.data.code == 1) {
that.setData({
status: res.data.data
})
http.ajax({
url: app.globalData.orderUrl + 'order/order_info',
data: {
user_id: 1,
uid: 1,
limit : limit,
status: res.data.data[0].status
},
success: function (re) {
console.log(re)
if (re.data.code == 1) { for (var i = 0; i < re.data.data.length; i++) {
re.data.data[i].create_time = formatTime.formatTime(re.data.data[i].create_time * 1000, 'yyyy-MM-dd hh:mm:ss')
} that.setData({
list: re.data.data,
limit : limit
}) }
}
})
}
}
})
setTimeout(function () {
wx.hideLoading()
}, 800)
}