Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat small program API pull-down refresh


May 19, 2021 WeChat Mini Program Development Document


Table of contents


onPullDownRefresh


Define the onPullDownRefresh handler in Page to listen for the page user's pull-down refresh event.

  • enablePullDownRefresh needs to be turned on in config window options.
  • When the data refresh is processed, wx.stopPullDownRefresh stop the pull-down refresh of the current page.

wx.startPullDownRefresh(OBJECT)

Base library 1.5.0 starts to support, and low versions need to be compatible

Start a pull-down refresh, trigger a pull-down refresh animation after the call, and the effect is consistent with the user's manual pull-down refresh

Object parameter description:

Parameters Type Required Description
success Function Whether The interface calls a successful callback function
fail Function Whether The interface calls the failed callback function
complete Function Whether Callback function at end of interface call (call succeeds, fails are executed)

Success returns a description of the parameters:

The name of the argument Type Description
errMsg String The result of the interface call

Example code:

wx.startPullDownRefresh()

wx.stopPullDownRefresh()

Stop the current page pull-down refresh.

Example code:

Page({
  onPullDownRefresh: function(){
    wx.stopPullDownRefresh()
  }
})