ionic3 浏览器端返回

首屏component.ts文件中使用
setupBrowserBackButtonBehavior() {
// Register browser back button action(s) window.onpopstate = (evt) => { // Close menu if open // Close any active modals or overlays let activePortal = this.ionicApp._loadingPortal.getActive() || this.ionicApp._modalPortal.getActive() || this.ionicApp._toastPortal.getActive() || this.ionicApp._overlayPortal.getActive(); if (activePortal) { activePortal.dismiss(); return; } // Navigate back if (this.navCtrl.canGoBack()) { this.app.goBack(); }else { WeixinJSBridge.call('closeWindow'); } }; // Fake browser history on each view enter this.app.viewDidEnter.subscribe((app) => { history.pushState(null, null, ""); }); }

 

posted on 2018-05-24 23:26  changYao  阅读(1098)  评论(0编辑  收藏  举报