Commit 8a5e46ea96e84eb04a12094bd7eadecfb6c7ca08
1 parent
00eb5258
首页和个人中心onshow时设置tabbar购物车数量
Showing
2 changed files
with
7 additions
and
0 deletions
pages/index/index/index.js
| @@ -298,6 +298,9 @@ Page({ | @@ -298,6 +298,9 @@ Page({ | ||
| 298 | }, | 298 | }, |
| 299 | 299 | ||
| 300 | async onShow() { | 300 | async onShow() { |
| 301 | + this.getTabBar().setData({ | ||
| 302 | + cartGoodsNum: getApp().globalData.cartGoodsNum | ||
| 303 | + }) | ||
| 301 | var th = this; | 304 | var th = this; |
| 302 | //-- 登录回来判断弹框 -- | 305 | //-- 登录回来判断弹框 -- |
| 303 | var user_id=getApp().globalData.user_id; | 306 | var user_id=getApp().globalData.user_id; |
pages/user/index/index.js
| @@ -58,6 +58,7 @@ Page({ | @@ -58,6 +58,7 @@ Page({ | ||
| 58 | * 生命周期函数--监听页面加载 | 58 | * 生命周期函数--监听页面加载 |
| 59 | */ | 59 | */ |
| 60 | onLoad: function(options) { | 60 | onLoad: function(options) { |
| 61 | + | ||
| 61 | var th=this; | 62 | var th=this; |
| 62 | //-- 读取会员中心按钮列表 -- | 63 | //-- 读取会员中心按钮列表 -- |
| 63 | getApp().request.get("/api/weshop/userTool/page?pageSize=100", { | 64 | getApp().request.get("/api/weshop/userTool/page?pageSize=100", { |
| @@ -98,6 +99,9 @@ Page({ | @@ -98,6 +99,9 @@ Page({ | ||
| 98 | * 生命周期函数--监听页面显示 | 99 | * 生命周期函数--监听页面显示 |
| 99 | */ | 100 | */ |
| 100 | onShow: function() { | 101 | onShow: function() { |
| 102 | + this.getTabBar().setData({ | ||
| 103 | + cartGoodsNum: getApp().globalData.cartGoodsNum, | ||
| 104 | + }) | ||
| 101 | //看一下小程序是不是过期了 | 105 | //看一下小程序是不是过期了 |
| 102 | getApp().getConfig2(function(config2){ | 106 | getApp().getConfig2(function(config2){ |
| 103 | if(config2 && config2.is_overdue==1){ | 107 | if(config2 && config2.is_overdue==1){ |