1
我想隐藏在Ionic 2中。我尝试了<ion-navbar [hidden]="true">
,但它不起作用。如何隐藏Ionic2中的导航栏
任何人都可以请告诉我如何有条件地隐藏在ionic2的导航栏?
我想隐藏在Ionic 2中。我尝试了<ion-navbar [hidden]="true">
,但它不起作用。如何隐藏Ionic2中的导航栏
任何人都可以请告诉我如何有条件地隐藏在ionic2的导航栏?
你可以使用一个属性从您的组件隐藏/显示它
<ion-navbar *ngIf="showNavbar">
而在你的组件代码:
import { Component, ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';
@Component({
selector: 'page-home',
templateUrl: 'home.html'
})
export class HomePage {
@ViewChild(Content) content: Content;
public showNavbar: boolean;
// ...
public hideNavbar(): void {
this.showNavbar = false;
// You should resize the content to use the space left by the navbar
this.content.resize();
}
}
宾果。非常感谢先生。 – raju
很高兴帮助:) – sebaferreras