search
HomeWeChat AppletMini Program DevelopmentHow to implement pull-up loading in WeChat applet development

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!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft