const app = getApp(); Component({ properties: { }, data: { shixuns:[] }, attached(){ this.options = {page:0, per_page:16}; this.pullShixuns(); //console.log(this.options) }, methods: { async pullShixuns({refresh=0}={}){ if(refresh){ if(refresh==1){ this.options.page = 1; var { options } = this; }else if(refresh==2){ var {page, per_page} = this.options; var options = {page:1, per_page: page*per_page}; } }else{ this.options.page++; var {options} = this; }let {shixuns} = await app.api("users.shixuns")(options); if(!refresh) shixuns = this.data.shixuns.concat(shixuns); this.setData({shixuns}); return shixuns; }, onPullDownRefresh(){ this.pullShixuns({refresh:2}); }, onReachBottom(){ this.pullShixuns({refresh:0}); } } })