如何在 Ionic 2 中隐藏带有标签的导航栏? [英] How to hide nav-bar with tabs in Ionic 2?

查看:34
本文介绍了如何在 Ionic 2 中隐藏带有标签的导航栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 Ionic 2 中隐藏带有标签的导航栏?

我只想将它隐藏在其中一个页面中,不包括其他页面.

我试过 hide-nav-bar="true" 但它不起作用.

解决方案

从一个标签页你可以做到:

this.nav.parent.parent.setRoot(LoginPage);

之前:

导航 -> 选项卡 -> 某页

之后:

导航 -> 登录页面

<块引用>

Nav 是 Ionic 2 中所有导航堆栈的根

此外,当您希望在新视图中显示列表项的详细信息而不需要导航选项卡或导航栏占用宝贵的屏幕空间时,模式也非常适用.

目前,除了使用 CSS 之外,我认为在标签页的子视图中没有其他方法可以隐藏标签.如果您决定使用 CSS 选项,那么我建议您使用 Angular 的 ngClass 属性 https://angular.io/docs/ts/latest/api/common/index/NgClass-directive.html 设置一个类而不是隐藏导航选项卡或导航栏.p>

How to hide nav-bar with tabs in Ionic 2?

I only want to hide it in one of the pages excluding others.

<ion-navbar *navbar   >
  <ion-title>Item Details</ion-title>
</ion-navbar>

I have tried hide-nav-bar="true" but it does not work.

解决方案

From a tab page you can do:

this.nav.parent.parent.setRoot(LoginPage);

Before:

Nav -> Tabs -> somepage

After:

Nav -> LoginPage

Nav is the root of all nav stacks in Ionic 2

Also, a modal works well for a situation where you want to show a list item's detail in a new view without navigation tabs or a nav bar taking up valuable screen space.

Currently I don't think there is a way to hide tabs when on the child view of the tabs page other than using CSS. If you decide to go with the CSS option then I would suggest using Angular's ngClass attribute https://angular.io/docs/ts/latest/api/common/index/NgClass-directive.html to set a class than will hide the nav tabs or nav bar.

这篇关于如何在 Ionic 2 中隐藏带有标签的导航栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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