data:{
by_no: 1, //页码
}
onLoad: function (options) {
this.getmessageList()
},
getmessageList:function(){
var that = this
wx.showLoading({
title: '加载中...',
})
wx.request({
url: ''
method: "POST",
// 请求头部
header: {
'content-type': 'application/text'
},
data:{
by_no: that.data.by_no
},
success: function (res) {
if (coderes.data.messages.length > 0) {
var messageList = that.data.messageList.concat(coderes.data.messages);
that.setData({
messageList: messageList,
by_no: that.data.by_no + 1
})
// 隐藏加载框
wx.hideLoading();
} else {
wx.showToast({
title: '没有更多了',
icon: 'none',
mask: true
})
return;
}
}
})
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
this.getmessageList()
},
微信小程序上拉加载更多
最新推荐文章于 2024-06-05 07:15:00 发布