// pages/topic/addList.js let App = getApp(); Page({ /** * 页面的初始数据 */ data: { list: [], noMore: false }, token: '', pageNum: 1, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { this.get_list(); }, /** * 获取列表 */ get_list: function(){ let that = this; wx.showLoading(); App._post_form('topic/getDuiHuanJl', { user_id: wx.getStorageSync('user_id'), page: this.pageNum }, result => { wx.hideLoading(); if (result.data.code == 0) { let oldList = that.data.list; let list = result.data.data; let h = {}; if(list.length < 30) h.noMore = false; list = list.concat(oldList); h.list = list; that.pageNum++; that.setData(h) } else { let h = {}; h.noMore = true; if(that.pageNum == 1) h.noMore = true; that.setData(h) } }); }, onReachBottom: function() { this.data.noMore || this.get_list(); } })