const app = getApp() Page({ /** * 页面的初始数据 */ data: { tempLine:[], pageSize:20 }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { const {chainId,searchTag} = options; this.getTempLine({chainId,searchTag}) }, getTempLine(params={}){ app.requestP({ url:'/chain/tempLine', method:'post', contentType: ' application/json', data:{ ...params } }).then(res=>{ this.setData({ tempLine:res.data.data.temps, tempLineConcat:res.data.data.temps.slice(0,40) }) }) }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady: function () { }, /** * 生命周期函数--监听页面显示 */ onShow: function () { }, /** * 生命周期函数--监听页面隐藏 */ onHide: function () { }, /** * 生命周期函数--监听页面卸载 */ onUnload: function () { }, /** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { var that = this; var pageSize = this.data.pageSize; if(pageSize >= that.data.tempLine)return; var temp = that.data.tempLine.slice(0,pageSize+20) this.setData({ pageSize:pageSize+20, },()=>{ that.setData({ tempLineConcat:temp }) }) }, /** * 用户点击右上角分享 */ onShareAppMessage: function () { } })