微信小程序 实现上拉加载

onReachBottom() {
        //上拉加载分页数据
        var that = this
        
            wx.showLoading({
                title: '玩命加载中',
            })
            that.data.pageIndex++ //页码自增
            //发起请求
            wx.request({
                url: `${config}/wxHomework/getStuUploadRecord`,
                data: {
                    page: that.data.pageIndex,
                    limit: that.data.pageSize,
                    stuId: wx.getStorageSync('studentInfo').id
                },
                success(resp) {
                    if (resp.data.code === 0) {
                        that.setData({
                            //拼接记录数据
                            uploadRecord: that.data.uploadRecord.concat(resp.data.page.list)
                        })
                    }
                    // 隐藏加载框
                    wx.hideLoading();
                }
            })
        
    },

触底触发  页码自增  列表拼接显示

你可能感兴趣的:(微信小程序)