赞
踩
页面事件处理函数-onPullDownRefresh()
(1) 需要在app.json的window选项中或页面配置中开启enablePullDownRefresh。
(2) 可以通过wx.startPullDownRefresh触发下拉刷新,调用后触发下拉刷新动画,效果与用户手动下拉刷新一致。
(3) 当处理完数据刷新后,wx.stopPullDownRefresh可以停止当前页面的下拉刷新。
{
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
}
window下修改 backgroundTextStyle:下拉 loading 的样式,默认是light,仅支持 dark / light
{
"backgroundTextStyle": "dark"
}
当处理完数据刷新后,可以用 stopPullDownRefresh 停止当前页面的下拉刷新。
Page({ onPullDownRefresh: function(){ wx.showNavigationBarLoading(); //在标题栏中显示加载图标 wx.request({ url: 'www.XXXX.com/xxx/xxxx', method: 'POST', header: { 'content-type': 'application/json' }, data: {}, success: function (res) { }, fail: function (res) { }, complete: function (res) { wx.hideNavigationBarLoading(); //完成停止加载图标 wx.stopPullDownRefresh(); } }) } })
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。