uniapp tabbar优先级过高uni-popup无法遮盖

2,305 阅读1分钟

如下图所示:

image.png

判断如果是tabbar页面时,在弹窗出现时隐藏tabbar,弹窗关闭时显示tabbar

image.png

uni-popup.vue修改如下:

computed: {
    // 是否tabbar
    isTabbar() {
        const tabbarList = ['/pages/home/home', '/pages/member/member']
        const url = '/' + uni.$util.getCurrentRoute()
        return tabbarList.includes(url)
    }
}
methods: {
    open(){
        xxxxxxx
        if (this.isTabbar) {
            uni.hideTabBar();
        }
    },
    close(){
        xxxxxxx
        if (this.isTabbar) {
            uni.showTabBar();
        }
    }
}

修改后如下图所示:

image.png