From 8a5e46ea96e84eb04a12094bd7eadecfb6c7ca08 Mon Sep 17 00:00:00 2001 From: taiwan Date: Fri, 10 Dec 2021 15:13:56 +0800 Subject: [PATCH] 首页和个人中心onshow时设置tabbar购物车数量 --- pages/index/index/index.js | 3 +++ pages/user/index/index.js | 4 ++++ 2 files changed, 7 insertions(+), 0 deletions(-) diff --git a/pages/index/index/index.js b/pages/index/index/index.js index 6d00fb1..b30c650 100644 --- a/pages/index/index/index.js +++ b/pages/index/index/index.js @@ -298,6 +298,9 @@ Page({ }, async onShow() { + this.getTabBar().setData({ + cartGoodsNum: getApp().globalData.cartGoodsNum + }) var th = this; //-- 登录回来判断弹框 -- var user_id=getApp().globalData.user_id; diff --git a/pages/user/index/index.js b/pages/user/index/index.js index d326f5d..935d344 100644 --- a/pages/user/index/index.js +++ b/pages/user/index/index.js @@ -58,6 +58,7 @@ Page({ * 生命周期函数--监听页面加载 */ onLoad: function(options) { + var th=this; //-- 读取会员中心按钮列表 -- getApp().request.get("/api/weshop/userTool/page?pageSize=100", { @@ -98,6 +99,9 @@ Page({ * 生命周期函数--监听页面显示 */ onShow: function() { + this.getTabBar().setData({ + cartGoodsNum: getApp().globalData.cartGoodsNum, + }) //看一下小程序是不是过期了 getApp().getConfig2(function(config2){ if(config2 && config2.is_overdue==1){ -- libgit2 0.21.4