重定向到下一页时如何避免页脚上的标签

How to avoid Tabs on footer when redirecting to next page

我的 页面有标签布局。单击我导航到下一个'this.navCtrl.push(NextPage);`的任何项目。

但问题出在我的第二页上,我也正在获取标签,看看这个 。导航完成后,我不再需要第二页中的选项卡。

how to avoid the tabs footer in the second page.

最简单的方法是使用 css 切换选项卡栏可见性,因为选项卡实际上是一个包含嵌套视图的组件。

因此您最好检测所选页面并切换 tabbar 显示。您可以通过 selectedIndex 跟踪所选页面或根据它添加 class。

从 Ionic 2.0.0-rc.1 开始,您可以使用配置 属性 tabsHideOnSubPages 在应用程序的配置对象中设置进入子页面时隐藏选项卡。您可以找到更多信息 here.

tabsHideOnSubPages (boolean): Whether to hide the tabs on child pages or not. If true it will not show the tabs on child pages.

您需要在 NgModule 中包含配置对象,在 IonicModule.forRoot(...) 方法中,如下所示:

import { IonicApp, IonicModule } from 'ionic-angular';

@NgModule({
  declarations: [ MyApp ],
  imports: [
    IonicModule.forRoot(MyApp, {
      // Configs for your app
      tabsHideOnSubPages: true
      // ...
    }, {}
  )],
  bootstrap: [IonicApp],
  entryComponents: [ MyApp ],
  providers: []
})