简体   繁体   中英

How to hide tabs in ionic2

Is it possible to remove tabs in ionic 2, My main component is as follows

<ion-tabs>
    <ion-tab [root]="tab1Root" tabTitle="Dash"> </ion-tab>
</ion-tab>

if I give It gives error saying

Can't bind to 'show' since it isn't a known property of 'ion-tabs'

I was able to successfully hide tab bar on a specific page.

First give an id to the component:

Then handle showing/hiding like this:

{
    templateUrl: '...',
})
export class PageWithoutTabBar
{

    constructor()
    {

        this.tabBarElement = document.querySelector('#tabs ion-tabbar-section');

    }

    ionViewDidEnter()
    {

this.tabBarElement.style.display = 'none';

    }

    ionViewWillLeave()
    {

        this.tabBarElement.style.display = 'block';

    }

}

在ionic 3中,尝试

<ion-tab [root]="tab2Root" tabTitle="Tab 2" tabIcon="contacts" show=false></ion-tab >

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM