const app = getApp() Page({ data: { imgUrls:[ "/assets/carousel/1.png", "/assets/carousel/2.png", "/assets/carousel/3.png" ], tableData: [], from: 0, size: 10, indicatorDots: false, autoplay: true, interval: 4000, duration: 800, }, swiperChange(e) { const that = this; that.setData({ swiperIndex: e.detail.current, }) }, onLoad: function(options) { this.setData({ spinShow: true }); this.search(true) }, onPullDownRefresh() { this.setData({ spinShow: true }); if (!this.loading) { this.setData({ from:0,tableData:[]}); this.search(true) } }, onReachBottom() { console.log( "onReachBottom", this.loading, this.data.from) if (!this.loading && this.data.from > -1) { this.search(false) } }, onShareAppMessage: function() { }, search: function(override) { let _this = this let param = {from: override?0:this.data.from, size:this.data.size} app.formPost('Post.getPostList', param ).then(res => { _this.setData({spinShow: false}); wx.stopPullDownRefresh() if (res.code === 200) { const re = res.data console.log( re ) _this.setData({ from: re.from, tableData: override ? re.list : this.data.tableData.concat(re.list) }); } }) } })