uni-app-Tabbar显示数字/红点的方法

907 阅读1分钟
    setTabBar() {
				var sum = 0
				for (var item of this.tabsum) {
					sum += item
				}
				if (sum == 0) {
					uni.removeTabBarBadge({
						index: 1
					})
					uni.hideTabBarRedDot({
						index: 1
					})
					return
				}
				uni.showTabBarRedDot({
					index: 1
				});
				uni.setTabBarBadge({
					index: 1,
					text: sum + ""
				})
			},