思想主要就就是调用webview的back方法,返回路由表的上一页,使用drag api,实现右滑到一个空的webview,然后监听,监听滑动事件结束,返回上一页。
onReady() {
var currentWebview = this.$scope.$getAppWebview();
const backRouter = throttle(e => {
reloadView.back()
}, 2000, {
"trailing": false
})
setTimeout(() => {
reloadView = currentWebview.children()[0];
reloadView.drag({
direction: 'right',
moveMode: 'silent'
}, {
view: "nullView",
moveMode: 'follow'
}, (e) => {
if (e.type === 'end') {
backRouter(e)
}
});
}, 1000);
},
onBackPress(e) {
this.$scope.$getAppWebview().children()[0].back();
return true;
},