在 Ionic 2 的子页面中隐藏标签 [英] Hide tabs in sub pages in Ionic 2

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

问题描述

我尝试在我的应用程序的所有子页面上隐藏标签.我用这个:

I try to hide tabs on all my subpages in my app. I use this :

<ion-tab [root]="MyPage" tabsHideOnSubPages="true" ...></ion-tab>

当我运行 ionic serve 时;这是工作.但是当我尝试在我的设备上运行它时,我的标签没有隐藏在子页面中,我无法使用它.

When I run ionic serve; it's work. But when I try to run it on my devices, my tabs aren't hide in the sub pages, and I can't use it.

有人想最终将我的标签隐藏在我的设备中吗?

Someone has an idea to finally hide my tabs in my devices ?

[更新]在我的子页面中,我有一个谷歌地图.如果我删除它,我就没有我的问题了.

[update] In my child page I have a google map. If I delete it I don't have my problem anymore.

子页面.html:

<ion-header>
  <c-header></c-header>
</ion-header>

<ion-content>
  <div id="map"></div>
</ion-content>

子页面.css:

#map {
  height: 50%;
}

子页面.ts:

import { Component } from '@angular/core';
import { NavController, Platform } from 'ionic-angular';
import { GoogleMap, GoogleMapsEvent, GoogleMapsLatLng } from 'ionic-native';

/*
  Generated class for the DetailsMedicalEvent page.

  See http://ionicframework.com/docs/v2/components/#navigation for more info on
  Ionic pages and navigation.
*/
@Component({
  selector: 'page-details-medical-event',
  templateUrl: 'details-medical-event.html'
})
export class DetailsMedicalEventPage {

  map: GoogleMap;

  constructor(public navCtrl: NavController, public platform: Platform) {
    platform.ready().then(() => {
      this.loadMap();
    });
  }

  loadMap(){

    let location = new GoogleMapsLatLng(-34.9290,138.6010);

    this.map = new GoogleMap('map', {
      'backgroundColor': 'white',
      'controls': {
        'compass': true,
        'myLocationButton': true,
        'indoorPicker': true,
        'zoom': true
      },
      'gestures': {
        'scroll': true,
        'tilt': true,
        'rotate': true,
        'zoom': true
      },
      'camera': {
        'latLng': location,
        'tilt': 30,
        'zoom': 15,
        'bearing': 50
      }
    });

    this.map.on(GoogleMapsEvent.MAP_READY).subscribe(() => {
      console.log('Map is ready!');
    });
  }
}

我真的需要一张地图.有人已经有这个问题了吗?

I really need to have a map. Someone already have this problem ?

推荐答案

您也可以尝试在 app.module.ts 文件中设置 tabsHideOnSubPages 配置属性,例如这个:

You can also try by setting the tabsHideOnSubPages config property in the app.module.ts file like this:

... 
imports: [
    IonicModule.forRoot(MyApp, {
        // Tabs config
        tabsHideOnSubPages: true,
        ...
    })
]
...

<小时>

来自 Ionic 文档:

tabsHideOnSubPages: boolean

是否隐藏子页面上的标签.如果为真,则不会在子页面上显示标签.

Whether to hide the tabs on child pages or not. If true it will not show the tabs on child pages.

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

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