This time I will show you how to implement pull-up loading in WeChat applet development. What are the precautions for pull-up loading in WeChat applet development? The following is a practical case, let’s take a look.
My current company's project is an e-commerce applet, which can be refreshed by pulling down. The official website clearly states that it cannot be used with scroll-view at the same time. I used onReachBottom and scroll-view's bindscrolltolower out of the blue. After my practice, I recommend everyone to use onReachBottom. If there are pull-down refreshes in some tabs, it is very convenient to directly enter the code:
onReachBottom() { let isPush = this.data.index, val = this.data.inputVal; this.setData({ isBtnShow: true }); if (isPush ==1) { let num = this.data.limitIndex; this.setData({ limitIndex: num+1 }) //关于上拉加载的性能优化 setTimeout(()=>{ // 给后端传下拉刷新的次数+1 const data = { limitIndex: this.data.limitIndex }; utils.sendRequest(api.AllGoodsUrl, data, this.handleReachBottom.bind(this)); },1500) }; if (val != '') { setTimeout(()=>{ let num = this.data.limitIndex; this.setData({ limitIndex: num+1 }) // 给后端传下拉刷新的次数+1 const data = { limitIndex: this.data.limitIndex, data:{ name: this.data.inputVal, } }; utils.sendRequest(api.AllGoodsUrl, data, this.handleLoadMore.bind(this)); },1500) }; },
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
How to use switchTab in WeChat applet development
JS implements statistics on data patterns within strings
The above is the detailed content of How to implement pull-up loading in WeChat applet development. For more information, please follow other related articles on the PHP Chinese website!