0

这是我的 app.components.ts 文件。我正面临 viewchild 的错误。使用离子 4.0.5。我想在我的应用程序中使用包含“菜单”的导航栏。

   import { Component } from '@angular/core';
    import { Platform } from 'ionic-angular';
    import { StatusBar } from '@ionic-native/status-bar';
    import { SplashScreen } from '@ionic-native/splash-screen';
    import { NavController } from 'ionic-angular';
    import { Menu } from '../pages/menu/menu';
    @Component({
      templateUrl: 'app.html'
    })
    export class MyApp {
      @ViewChild(Nav) nav: NavController;


      rootPage:any = Menu;

      constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen) {
        this.initializeApp();
      }


      initializeApp() {

      this.platform.ready().then (() => {

        this.statusBar.styleDefault();
        this.splashScreen.hide();
      });
      }
    }
4

1 回答 1

0

ViewChild在ts文件中导入

import { Component,ViewChild } from '@angular/core';
@ViewChild(Nav) nav: NavController;
于 2018-08-09T06:15:48.997 回答