Ionic 2 - Multiple menu at the same time (right - left)

≯℡__Kan透↙ 提交于 2019-12-04 02:21:26

Just like you can see here, you need to add side="left" and side="right" like this:

<ion-menu [content]="content" side="left" id="menu1">...</ion-menu>

And

<ion-menu [content]="content" side="right" id="menu2">...</ion-menu>

EDIT:

Thanks @johnnyfittizio for your comments! I've made the changes you mentioned there (please edit this answer if I forgot something).

So basically we just need to add both menus (for instance, in the app.html page) like this:

<ion-menu [content]="content" side="left" id="menu1">
  <ion-content>
    <ion-list>
      <button ion-item menuClose="menu1" detail-none>
        Close Menu 1
      </button>
    </ion-list>
  </ion-content>
</ion-menu>

<ion-menu [content]="content" side="right" id="menu2">
  <ion-content>
    <ion-list>
      <button ion-item  menuClose="menu2" detail-none>
        Close Menu 2
      </button>
    </ion-list>
  </ion-content>
</ion-menu>



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

Then we need to add both menu buttons in the header like this:

<ion-header>
  <ion-navbar primary>
    <button ion-button menuToggle="left" start>
      <ion-icon name="menu"></ion-icon>
    </button>
    <ion-title>
      HomePage
    </ion-title>
    <button ion-button menuToggle="right" end>
      <ion-icon name="menu"></ion-icon>
    </button>
  </ion-navbar>
</ion-header>

<ion-content padding>
  <p>Home page</p>

</ion-content>

Please notice that each button has the menuToggle="left" or menuToggle="right" property to be able to toggle the proper menu.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!