{“errMsg“:“setTabBarBadge:fail not TabBar page“}

问题描述:想要在详情页添加商品到购物车后,同时更新tabBar页面的购物袋徽标。于是直接在goods-detail页面使用以下代码后,发现报错:

uni.setTabBarBadge({
					  index: 3,
					  text: this.goodsCount+''
					})

 错误信息:{"errMsg":"setTabBarBadge:fail not TabBar page"}

错误原因:设置徽标必须在当前页面设置,所以设置tabBar购物袋页面徽标也必须在购物袋页面才能设置 。

	uni.setTabBarBadge({
			  index: 3,
			  text: this.goodsCount+''
			})

猜你喜欢

转载自blog.csdn.net/qq_34569497/article/details/131437740