簡體   English   中英

Ionic 2側面菜單未彈出

[英]Ionic 2 Side Menu Not Popping Up

截至昨晚,我對Ionic還是陌生的,我創建了一個空白項目,但現在卻愚蠢地意識到,我想在其中添加一個側面菜單。 因此,我已經按照幾個在線教程進行了添加,但是無論我嘗試什么,只要單擊菜單切換圖標按鈕,我都可以顯示菜單。

這是我添加來嘗試使之工作的內容:

app.html

<ion-menu side="right" [content]="content">
    <ion-content>
        <ion-list>
            <button>Page 1</button>
            <button>Page 2</button>
        </ion-list>
    </ion-content>
</ion-menu>

<ion-nav #content [root]="rootPage" swipeBackEnabled="false"></ion-nav>

app.component.ts:

import { Component, ViewChild } from '@angular/core';
import { Platform, Nav } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { HomePage } from '../pages/home/home';
@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage:any = HomePage;
  @ViewChild(Nav) nav: Nav;

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      splashScreen.hide();
    });
  }
}

home-logged-in.html:

<ion-header>
  <ion-navbar color='primary'>
    <button ion-button menu-toggle>
      <ion-icon name="menu"></ion-icon>
    </button>
  </ion-navbar>

</ion-header>


<ion-content padding>

</ion-content>

屬性錯誤。 更換:

<button ion-button menu-toggle>

帶有:

<button ion-button menuToggle>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM