js
getUserArticles: function () {if(this.data.page>0){
this.setData({
articles: this.data.articles.concat(obj.data.articles),
});
console.log('new_articles', this.data.articles)
}else{
this.setData({
articles: obj.data.articles,
});
}
}
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
// 模拟加载
// setTimeout(() => {
// // complete
// wx.stopPullDownRefresh() //停止下拉刷新
// // this.setData({
// // topview: 0
// // })
// }, 500);
this.data.page = 1
this.data.articles = []
console.log('下拉事件')
this.getUserArticles();
},
/**
* 页面下拉触底事件的处理函数
*/
onReachBottom: function () {
if(this.data.page == 0){
this.data.page = 1;
}else{
this.data.page++
}
console.log('bottompage',this.data.page);
this.getUserArticles();
},
json
{
"enablePullDownRefresh": true,
"backgroundTextStyle": "dark"
}