uni-app uni.setTabBarBadge() 在tabber页面设置后只执行了一次

uni-app uni.setTabBarBadge() 在tabber页面设置后只执行了一次

产品分类:

HTML5+

HBuilderX版本号:

3.1.10

手机系统:

全部

打包方式:

云端

测试过的手机:

小米 iphone

示例代码:

onShow(){  
    this.tabsData[0].params.pageNum = 1;  
    this.getFlowProcessApplyList();  
    this.getFlowProcessNuread();  
    this.getProcessList(0);  
},  
setTabBarBadgeMethod() {  
    if (this.noticeTotal > 0) {  
        console.log('111111:'+this.noticeTotal)  
        uni.setTabBarBadge({  
            index:1,  
            text: this.noticeTotal  
        })    
    } else {  
        uni.removeTabBarBadge({  
            index: 1,  
        })  
    }  
},  
getProcessList(idx) {  
    var params ={  
        id:1  
    }  
    this.$http('get', 'flowProcessList', params).then(res => {  
        this.noticeTotal = String(res.total);  
        this.setTabBarBadgeMethod()  
    }).catch(() => {  
    });  
},

操作步骤:

第一项 tabber 使用了一次 uni.setTabBarBadge() 是正常的
第二项tabber 在使用uni.setTabBarBadge()只执行了一次 放到onload onshow 使用uni.$emit 也不行

预期结果:

想实时刷新第二个tabber 角标的值

实际结果:

只有tabber的第一项正常刷新角标 ,第二项tabber只执行了一次

bug描述:

我在 第一项 tabber 使用了一次 uni.setTabBarBadge() 是正常的
第二项tabber 在使用uni.setTabBarBadge()只执行了一次 放到onload onshow 使用uni.$emit 也不行

Image


更多关于uni-app uni.setTabBarBadge() 在tabber页面设置后只执行了一次的实战教程也可以访问 https://www.itying.com/category-93-b0.html

回到顶部