【问题标题】:Ionic Pages - changing contentIonic Pages - 改变内容
【发布时间】:2018-02-23 01:47:02
【问题描述】:

app.html

<ion-header>
    <ion-navbar>
        <ion-title>Blabla</ion-title>
        <button ion-button color="primary" (click)="home()">Home</button>
        <button ion-button color="primary" (click)="second()">Second</button>
    </ion-navbar>
</ion-header>
<ion-content>
</ion-content>
<ion-nav #myNav [root]="rootPage"></ion-nav>

app.component.ts

import { Component, ViewChild } from '@angular/core';
import { Platform, NavController } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';

import { HomePage } from '../pages/home/home';
import { SecondpagePage } from '../pages/secondpage/secondpage';
@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  @ViewChild('myNav') nav: NavController;
  rootPage:any = HomePage;

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      splashScreen.hide();
    });
  }

  home() {
    this.nav.setRoot(HomePage);
  }

  second() {
    this.nav.setRoot(SecondpagePage);
  }

}

在 HomePage 和 SecondPage 我只放了&lt;ion-content&gt;Test1&lt;/ion-content&gt;&lt;ion-content&gt;Test2&lt;/ion-content&gt;。 现在我遇到了这种情况 - 标题“覆盖”了其余部分。所以我看不到任何文字,因为它在标题下方。我怎样才能改变这种行为? 而且我还想使用一个静态不可移动的标题/导航栏(因为会有动画)。因此,可以更改的内容在该标题/导航栏下。

【问题讨论】:

    标签: ionic-framework ionic2 ionic3


    【解决方案1】:

    尝试将ion-nav 移动到ion-content 中,这应该可以使其正常运行。

    【讨论】:

    • 不幸的是,它不起作用。还是一样的效果。
    猜你喜欢
    • 1970-01-01
    • 2015-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-02
    • 2020-11-24
    • 2011-10-25
    相关资源
    最近更新 更多