Home  >  Article  >  WeChat Applet  >  How to pull down to refresh the mini program

How to pull down to refresh the mini program

angryTom
angryTomOriginal
2020-03-21 10:51:124085browse

How to pull down to refresh the mini program

How to pull down to refresh in the mini program

In the mini program, pull down to refresh at the top of the user is disabled by default, we need to set it to enable , the settings in app.json are valid for all pages, and the settings on a single page are valid for the current page.

Recommended learning: Small program development

The specific implementation method is as follows:

1. Set up the json file

"enablePullDownRefresh": true,

2. Write the drop-down refresh js code

//下拉刷新
onPullDownRefresh:function()
{
    wx.showNavigationBarLoading() //在标题栏中显示加载
    //模拟加载
    setTimeout(function()
    {
        // complete
        wx.hideNavigationBarLoading() //完成停止加载
        wx.stopPullDownRefresh() //停止下拉刷新
    },1500);
},

wx.hideNavigationBarLoading() These two sentences are used to control the display and hiding of the small chrysanthemum. Here, network loading is simulated, and a time delay is written through the setTimeout method. method, this method can simulate the time consumed by network loading, and when the network loading is completed, we need to stop the pull-down refresh wx.stopPullDownRefresh().

PHP Chinese website, a large number of free navicat tutorials, welcome to learn!

The above is the detailed content of How to pull down to refresh the mini program. 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