uni-app web-view跳转外链后无法返回APP页面
一、问题描述
uni-app 使用 web-view 标签跳转外部链接后,在 Android 手机上无法返回至 APP 内,IOS 正常返回。
二、解决方法
在 web-view 所在页面监听 onBackPress 生命周期,在其内部添加如下代码。
1 onBackPress(e) {
2 if (e.from === 'backbutton') {
3 this.$scope.$getAppWebview().children()[0].close()
4 setTimeout(() => {
5 uni.navigateBack()
6 }, 0)
7 return true
8 }
9 },
标题:uni-app web-view跳转外链后无法返回APP页面
作者:zzzzchen
地址:https://dczzs.com/articles/2021/05/25/1621914771259.html