https://ke.qq.com/course/365835?taid=2931345244656907
按照这个教程写的云开发 数据库实战
没有下拉刷新前可以正常加载,刷新后触底加载的数据就成0了,只显示20条数据
/** * 页面相关事件处理函数--监听用户下拉动作 */ onPullDownRefresh: function () { indexCollection.get().then(res => { this .setData({ index: res.data },res => { wx.stopPullDownRefresh() wx.showToast({ title: '刷新成功' , icon: "none" }) }, 200) }) }, /** * 页面上拉触底事件的处理函数 */ onReachBottom: function () { console.log( "触底啦" ) let page = this .data.page + 20; console.log(page) indexCollection.skip(page).get().then(res => { let new_data = res.data let old_data = this .data.index console.log(res) this .setData({ index: old_data.concat(new_data), page: page }, res => { console.log(res); }) }) }, |
仅供参考:
https://developers.weixin.qq.com/community/develop/article/doc/000cc87a7007885df5b862b3d51c13