监听返回事件,在返回的生命周期函数onBackPress中获取webview对象,并关闭
返回false代表回退,返回true不回退。
具体参考官网:https://uniapp.dcloud.net.cn/tutorial/page.html#lifecycle
onBackPress(options) { console.log(options) let pages = getCurrentPages() let page = pages[pages.length - 1]; let currentPages = page.$getAppWebview() let children = currentPages.children() children[0].close() return false }