Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/eclipse/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ionic framework 对于ionic 5中的this.app.getActiveNavs()[0]和this.app.\u appRoot.\u getPortal()替换了哪种语法_Ionic Framework_Ionic4 - Fatal编程技术网

Ionic framework 对于ionic 5中的this.app.getActiveNavs()[0]和this.app.\u appRoot.\u getPortal()替换了哪种语法

Ionic framework 对于ionic 5中的this.app.getActiveNavs()[0]和this.app.\u appRoot.\u getPortal()替换了哪种语法,ionic-framework,ionic4,Ionic Framework,Ionic4,我把代码从爱奥尼亚3迁移到爱奥尼亚5,这是在爱奥尼亚3中 import { App } from 'ionic-angular'; private app: App let nav = this.app.getActiveNavs()[0]; let portal = this.app._appRoot._getPortal(); 但在爱奥尼亚5中,看起来像是“应用程序”被移动到了NavController方法“navigateRoot”(我不知道如何使用它?)。 还有_getPortal

我把代码从爱奥尼亚3迁移到爱奥尼亚5,这是在爱奥尼亚3中

import { App } from 'ionic-angular';

private app: App

let nav = this.app.getActiveNavs()[0];
let portal = this.app._appRoot._getPortal();
但在爱奥尼亚5中,看起来像是“应用程序”被移动到了NavController方法“navigateRoot”(我不知道如何使用它?)。 还有_getPortal(),我不知道它移到了什么地方?如何获得入口长度

这是ionic3的原始代码

import { App } from 'ionic-angular';

this.platform.registerBackButtonAction(() => {
      let nav = this.app.getActiveNavs()[0];
      const portal = this.app._appRoot._getPortal();

      if (portal.length() == 0) {
        if (nav.canGoBack()){
          this.app.navPop();
        } else {
            this.showExitingConfirm();
        }
      } else {
        this.app.navPop();
      }
    });