json配置:
{
“enablePullDownRefresh”: true
}
js方法:
/**
* 页面相关事件处理函数–监听用户下拉动作
*/
onPullDownRefresh: function () {
var currentPage = this.data.currentPage-1
if(currentPage >= 1 ){
this.setData({
currentPage: currentPage
})
this.searchInfo(app.globalData.condition,currentPage)
}else{
wx.showToast({
title: ‘已经是第一页了’,
icon:‘loading’
})
}
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
var currentPage = this.data.currentPage+1
if (currentPage <= this.data.totalPage) {
this.setData({
currentPage: currentPage
})
this.searchInfo(app.globalData.condition, currentPage)
} else {
wx.showToast({
title: ‘已经是最后一页了’,
icon: ‘loading’
})
}
},