微信小程序下拉刷新 并重新加载数据


1.在json页面配置:

{ "enablePullDownRefresh": true }

2.调用刷新函数

 onPullDownRefresh: function() {
   wx.showNavigationBarLoading()  //在标题栏中显示加载
 this.updateBlogs() //重新加载数据
    //模拟加载  1秒
    setTimeout(function () {
    // complete
    wx.hideNavigationBarLoading() //完成停止加载
    wx.stopPullDownRefresh() //停止下拉刷新
    }, 1000);
 },

updateBlogs: function () { var that = this wx.request({ url: common.baseUrl + 'blog_rss.php', data: { }, header: { 'Content-Type': 'application/json' }, success: function (res) { var feeds = feed.getBlogs(res.data); wx.setStorage({ key: "blog_feeds", data: feeds }) that.setData({ feeds: feeds }) } }) }
 


免责声明!

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



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