在 page 中定义 onpulldownrefresh 处理函数,监听该页面用户下拉刷新事件。
config
的window
选项中开启enablepulldownrefresh
。wx.stoppulldownrefresh
可以停止当前页面的下拉刷新。基础库 1.5.0 开始支持,低版本需做兼容处理
开始下拉刷新,调用后触发下拉刷新动画,效果与用户手动下拉刷新一致
object参数说明:
参数 | 类型 | 必填 | 说明 |
---|---|---|---|
success | function | 否 | 接口调用成功的回调函数 |
fail | function | 否 | 接口调用失败的回调函数 |
complete | function | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) |
success返回参数说明:
参数名 | 类型 | 说明 |
---|---|---|
errmsg | string | 接口调用结果 |
示例代码:
wx.startpulldownrefresh()
停止当前页面下拉刷新。
示例代码:
page({
onpulldownrefresh: function(){
wx.stoppulldownrefresh()
}
})