如何在推送新页面时保留标签? [英] How to keep tab when pushing a new page?

查看:149
本文介绍了如何在推送新页面时保留标签?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在我的控制器中按下这样的新标签时:

When I push a new tab like this in my controller:

this.nav.push(EditPage);

标签消失。如何保留标签?

the tab disappears. How can I keep the tab?

下图:

当新页面出现时:

When the new page comes:

推荐答案

您需要在 ionicBootstrap 中添加 tabSubPages:false config,如下所示:

You'd need to add the tabSubPages:false config in your ionicBootstrap like this:

ionicBootstrap(MyApp, [], {      
    tabSubPages:false
});

通过这样做,并且因为每个标签都有自己的历史堆栈,并且 NavController 注入每个选项卡的子项 @Components 的实例对每个选项卡都是唯一的,新页面将在当前选项卡中打开。

By doing that, and because that each tab has its own history stack, and NavController instances injected into children @Components of each tab will be unique to each tab, the new page will be opened inside the current tab.

更新:

请请注意新版本的Ionic 2.0.0-beta.11(2016-08-05)配置重命名为 tabsHideOnSubPages 所以应该是:

Please notice that with the new release of Ionic 2.0.0-beta.11 (2016-08-05) that config was renamed to tabsHideOnSubPages so it should be:

ionicBootstrap(MyApp, [], {      
    tabsHideOnSubPages:false
});




之前的名称已被弃用。它们仍将在
当前版本中运行,但将来会被删除,所以请更新为
新名称。

The previous names have been deprecated. They will still work in the current release but will be removed in the future so please update to the new names.

这篇关于如何在推送新页面时保留标签?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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