// pages/detailed/detailed.js const app = getApp(); const { axios } = app.globalData; Page({ /** * 页面的初始数据 */ data: { datalist: [] }, // 请求明细 totalPage: 1, currentPage: 1, Request () { if (this.totalPage < this.currentPage) return false; let { datalist } = this.data, that = this; axios({ url: '/option/balance_log/', method: 'get', success (res) { let { data } = res.data; datalist = [...datalist, ...data]; that.currentPage++; that.setData({ datalist }) wx.stopPullDownRefresh(); } }) }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { wx.lxd.Ctr({ // nav title: "账单明细", //标题 }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { this.Request(); }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { this.currentPage = 1; this.totalPage = 1; this.setData({ datalist: [] }) this.Request(); }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { this.Request(); }, })