uni-app 重定向同一页面时subnvue默认无法隐藏

uni-app 重定向同一页面时subnvue默认无法隐藏

项目 内容
产品分类 uniapp/App
PC开发环境操作系统 Windows
PC开发环境操作系统版本号 win10
HBuilderX类型 正式
HBuilderX版本号 3.3.9
手机系统 Android
手机系统版本号 Android 11
手机厂商 华为
手机机型 荣耀8X(鸿蒙系统)
页面类型 vue
vue版本 vue2
打包方式 云端
项目创建方式 HBuilderX

操作步骤:

onLoad(o) {  
    uni.getSubNVueById('subnvue').hide()  
    console.log('进入页面')  
    if (o.index == null) {  
        console.log('开始跳转页面页面')  
        setTimeout(() => {  
            uni.redirectTo({  
                url: '/pages/index/index?index=1'  
            })  
        }, 5000)  
    }  
},

更多关于uni-app 重定向同一页面时subnvue默认无法隐藏的实战教程也可以访问 https://www.itying.com/category-93-b0.html

11 回复

试试下面的代码:
const currentWebview = this.$scope.$getAppWebview();
const subnvue = currentWebview.children().find(v => v.id === ‘subnvue’) // ‘subnvue’ 为你的 subnvue 的 id
subnvue.hide() ;

更多关于uni-app 重定向同一页面时subnvue默认无法隐藏的实战教程也可以访问 https://www.itying.com/category-93-b0.html


放在onLoad里 重定向后subnvue会找不到, 放在onReady重定向后是可以隐藏但是会闪下

有没有什么配置能让子窗体默认隐藏的

回复 萌龙: 可以试试通过 pages.json 中设置 subnvue 的 style opacity 或 position 和 top、left

回复 DCloud_UNI_LXH: subnvue.setStyle 没法设置width height为0吗

回复 萌龙: 按说可以,你设置试试

回复 DCloud_UNI_LXH: 我在page.json里设置为width:0 height:0 页面调用的时候设置成width:100% height:100% 要关闭的时候没法置为width:0 height:0 只能设置为置为width:1 height:1

回复 DCloud_UNI_LXH: 新传了个附件可以看看

顶顶顶顶

顶顶顶顶

我也遇到这个问题

回到顶部