uniapp 隐藏nvue子窗口 不生效

下面是uniapp官方给到, 显示和关闭 NVue子窗体的方法
 
// 通过 id 获取 nvue 子窗体  
const subNVue = uni.getSubNVueById('map_widget')  
// 打开 nvue 子窗体  
subNVue.show('slide-in-left', 300, function(){  
    // 打开后进行一些操作...  
    //   
});  
// 关闭 nvue 子窗体  
subNVue.hide('fade-out', 300)

 




但是实际app开发中,关闭
nvue 子窗体时候,
subNVue.hide没有效果

用下面方法可以解决:

 

 

const currentWebview = this.$scope.$getAppWebview()
const subnvue = currentWebview.children().find((v) => v.id === 'detailBtn') // 'subnvue' 为你的 subnvue 的 id
subnvue.hide()

 

posted @ 2023-03-17 14:34  梓色心晴  Views(85)  Comments(0Edit  收藏  举报