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

微信小程序下拉刷新 并重新加载数据,第1张

微信小程序下拉刷新 并重新加载数据 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
})
}
})
}
 

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/587624.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-12
下一篇 2022-04-12

发表评论

登录后才能评论

评论列表(0条)

保存