解决微信小程序使用switchTab跳转后页面不刷新的问题 微信小程序点击tabBar刷新页面

微信小程序点击导航栏菜单tabBar第一次的时候页面内容会刷新,那是因为调用了onLoad函数,但是点击其他菜单页再次返回第一点击的页面,页面无刷新,我的解决方法

就是调用onShow函数:

onShow: function(){

var that =this;

wx.request({

url: app.globalData.web_url+'yourApi?open_id='+ wx.getStorageSync('open_id'),

success: function(res){

that.setData({

cartList: res.data.cartList,

cartSize: res.data.cartSize,

totalAmount: res.data.totalAmount

})

}

})

},

,刷新效果就出现了。欢迎批评讨论。

可以在小程序看看效果,也可以提问QQ739977464

在这里插入图片描述

发布了135 篇原创文章 · 获赞 88 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/weixin_42981560/article/details/99817005