【问题标题】:Ionic 2 Side Menu Not Popping UpIonic 2 侧边菜单未弹出
【发布时间】:2017-09-27 12:12:35
【问题描述】:

截至昨晚,我对 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>

【问题讨论】:

    标签: html angular typescript ionic2


    【解决方案1】:

    错误的属性。替换:

    <button ion-button menu-toggle>
    

    与:

    <button ion-button menuToggle>
    

    【讨论】:

      猜你喜欢
      • 2016-05-24
      • 2017-04-12
      • 2023-03-16
      • 1970-01-01
      • 2020-08-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多