小程序下拉刷新步骤——完成


首先在app.json下“window”中进行如下设置:

"backgroundTextStyle": "dark",
"enablePullDownRefresh": true,
"onReachBottomDistance": 50
在需要进行下拉刷新的页面进行js设置:
onPullDownRefresh: function () {
  wx.showNavigationBarLoading(); //在标题栏中显示加载图标
  wx.request({
    url: 'www.XXXX.com',
    method: 'POST',
    data: {},
    success: function (res) {
      console.log(res)//完成调用后执行的函数
    },
    fail: function (res) {
      console.log(res)//调用失败后执行的函数
    },
    complete: function (res) {//调用失败或结束都会执行的函数
      wx.hideNavigationBarLoading(); //完成停止加载图标
      wx.stopPullDownRefresh();
    }
  })
}
注:header为默认设置


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM