@uni/pull-down-refresh
v1.0.3
Published
Downloads
6
Readme
onPullDownRefresh
Turn on drop-down refresh. The drop-down refresh triggers the "pulldownrefresh" event.
Supported
Install
$ npm install @uni/pull-down-refresh --save
or
$ npm install @uni/apis --save
Usage
import { onPullDownRefresh } from '@uni/pullDownRefresh';
onPullDownRefresh();
You can also import from the big package:
import { pullDownRefresh } from '@uni/apis';
pullDownRefresh.onPullDownRefresh();
You can add event listener:
pullDownRefresh.onPullDownRefresh({eventCallback: cb});
Methods
onPullDownRefresh(options)
Arguments
| Property | Type | Description | required | Default |
| --- | --- | --- | --- | --- |
| options | object
| | ✔️ | - |
| options.pullRefresh | boolean
| The switch of manual pulldownRefresh | ✘ | true |
| options.triggerDistance | number
| The pull-down distance required when the pull-down refresh is triggered | ✘ | 90 |
| options.eventCallback | Function
| The callback function when the event is triggered | ✘ | - |
| options.success | Function
| The callback function for a successful API call | ✘ | - |
| options.fail | Function
| The callback function for a failed API call | ✘ | - |
| options.complete | Function
| The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - |
startPullDownRefresh
Starts swipe-down-to-refresh.
Supported
Note: DingTalk miniprogram does not support startPullDownRefresh
Install
$ npm install @uni/pull-down-refresh --save
or
$ npm install @uni/apis --save
Usage
import { startPullDownRefresh } from '@uni/pullDownRefresh';
startPullDownRefresh();
You can also import from the big package:
import { pullDownRefresh } from '@uni/apis';
pullDownRefresh.startPullDownRefresh();
Methods
startPullDownRefresh(options)
Arguments
| Property | Type | Description | required | Default |
| --- | --- | --- | --- | --- |
| options | object
| | ✔️ | - |
| options.success | Function
| The callback function for a successful API call | ✘ | - |
| options.fail | Function
| The callback function for a failed API call | ✘ | - |
| options.complete | Function
| The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - |
stopPullDownRefresh
Disables swipe-down-to-refresh for the current page.
Supported
Install
$ npm install @uni/pullDownRefresh --save
or
$ npm install @uni/apis --save
Usage
import {stopPullDownRefresh} from '@uni/pullDownRefresh';
stopPullDownRefresh();
You can also import from the big package:
import { pullDownRefresh } from '@uni/apis';
pullDownRefresh.stopPullDownRefresh();
Methods
stopPullDownRefresh(options)
Arguments
| Property | Type | Description | required | Default | Supported |
| --- | --- | --- | --- | --- | --- |
| options | object
| | ✔️ | - | - |
| options.success | Function
| The callback function for a successful API call | ✘ | - | |
| options.fail | Function
| The callback function for a failed API call | ✘ | - | |
| options.complete | Function
| The callback function used when the API call completed (always executed whether the call succeeds or fails) | ✘ | - | |