ionic2保持侧面菜单打开 [英] ionic2 keeping side menu open

查看:139
本文介绍了ionic2保持侧面菜单打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用离子2,我在应用程序的左侧有一个离子菜单,当我打开菜单并触摸页面区域时,它会一直关闭。



我想让它保持打开状态,只有当用户明确要求关闭它时才能关闭(通过关闭按钮,或者可能会向后滑动,等等)。这样做是否有任何选择或解决方法?



编辑
我开始使用


I'm working with ionic 2, and I have a ion-menu on the left side of the app, which keeps closing when I open the menu and touch to the page area.

I'd like to make it to keep opened and to close only when the user explicitly order to close it(via close button, or maybe swiping back, whatever). is there any option or workaround to doing like that?

EDIT: I started with ionic2-starter-sidemenu. when I run it, it looks like:

---------------------------------------------------------------
|           | <menuToggle button>                             |
|           |-------------------------------------------------|
|           |                                                 |
|           |                                                 |
|     /*    |                                                 |
| side menu |                                                 |
| toggled by|                                                 |
| menuToggle|           /* Content of each Pages */           |
|   button  |                                                 |
|     */    |                                                 |
|           |                                                 |
|           |                                                 |
|           |                                                 |
---------------------------------------------------------------

and when I click the page content area, the menu closes like this:

---------------------------------------------------------------
| <menuToggle button>                                         |
|-------------------------------------------------------------|
|                                                             |
|                                                             |
|                                                             |
|                                                             |
|                /* Content of each Pages */                  |
|                                                             |
|                                                             |
|                                                             |
|                                                             |
|                                                             |
---------------------------------------------------------------

I tried reading documentation and searched ionic forum, but found nothing to resolve it.

解决方案

Hope this answer isn't too late. However ionic 2 now supports the splitplane that works exactly as you described. Its syntax is as:

<ion-split-pane>
  <!--  our side menu  -->
  <ion-menu [content]="content">
    <ion-header>
      <ion-toolbar>
        <ion-title>Menu</ion-title>
      </ion-toolbar>
    </ion-header>
  </ion-menu>

  <!-- the main content -->
  <ion-nav [root]="root" main #content></ion-nav>
</ion-split-pane>

这篇关于ionic2保持侧面菜单打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆