在有web-view的页面,如果点击左上角的后退按钮,会返回到web-view中url的上一个页面,而不是回到APP的父页面
采用如下代码,点击左上角后退按钮就可以回到父页面。
onBackPress(options) {
const currentWebview = this.$mp.page.$getAppWebview();
if(currentWebview){
let child=currentWebview.children();
for(let i=0;i<child.length;i++){
currentWebview.remove(child[i]);
}
}
return false;
}
PS:不要采用currentWebview.close(),uniapp下不好用,各种出错
7 个评论
要回复文章请先登录或注册
1***@qq.com
1***@qq.com
小权
1***@qq.com
7***@qq.com
l***@163.com
ssnet