Ionic 2在navCtrl推送后保持sidemenu图标 [英] Ionic 2 keep sidemenu icon after navCtrl push

查看:98
本文介绍了Ionic 2在navCtrl推送后保持sidemenu图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我使用navCtrl.push导航到某个页面时,sidemenu图标(汉堡包)会丢失,并且会显示后退图标而不是侧面图标。

When I navigate to a page using navCtrl.push, sidemenu icon (hamburger) is lost, and back icon is appearing instead of the sidemenu icon.

我是什么我想这样做,就是保留sidemenu图标(把它放在离子导航栏的右侧),当把页面推到navCtrl时,同时有后退按钮和侧面图标。

What I want to do, is to keep the sidemenu icon (put it on the right side of the ion-navbar), and when pushing a page to navCtrl, have both back button and sidemenu icon.

我在所有页面中使用这段代码:

I use this piece of code in all pages:

<ion-header>
  <ion-navbar>
    <button ion-button menuToggle right>
      <ion-icon name="menu"></ion-icon>
    </button>
    <ion-title>Post Offices</ion-title>
  </ion-navbar>
</ion-header>

我使用:

this.navCtrl.push(Page)

它工作正常(我虽然丢失了菜单图标,但没有其他问题。)

And it works fine (I lose the menu icon though, but there is no other problem).

推荐答案

您需要添加属性 persistent =true< ion-menu> 然后 menuToggle 按钮将是适用于所有观点。您可以在 docs

You need to add attribute persistent="true" to <ion-menu> then menuToggle button will be available on all views. You can find more details here in the docs

这篇关于Ionic 2在navCtrl推送后保持sidemenu图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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