【问题标题】:Ionic Tabs - header root pages above tabs离子标签 - 标签上方的标题根页面
【发布时间】:2019-12-28 01:29:14
【问题描述】:

我在根页面中的标题(工具栏)位置存在以下问题:

为什么标题根页面位于选项卡上方?我需要把它们放在孩子的页面中。

代码很简单:

 tabs.html

<ion-tabs tabsPlacement="top" tabsLayout="icon-bottom" tabsHighlight=true>
  <ion-tab [root]="tab1Root" tabTitle="Home" tabIcon="home"></ion-tab>
 <ion-tab [root]="tab2Root" tabTitle="About" tabIcon="information-circle"> 
 </ion-tab>
 <ion-tab [root]="tab3Root" tabTitle="Contact" tabIcon="contacts"></ion-tab>
</ion-tabs>


tab1Root (home.html)

<ion-header>
<ion-toolbar>
   <div >
      <small> 
        this is the toolbar ...
      </small>
    </div>

    <ion-buttons end>
      <button ion-button icon-only>
        <ion-icon name="more"></ion-icon>
      </button>
    </ion-buttons>
  </ion-toolbar>
</ion-header>


<ion-content padding>
  <h2>Welcome to Ionic!</h2>
 <p>
This starter project comes with simple tabs-based layout for apps
that are going to primarily use a Tabbed UI.
</p>
<p>
 Take a look at the <code>src/pages/</code> directory to add or change tabs,
 update any existing page or create new pages.
  </p>
 </ion-content>

谢谢。

【问题讨论】:

    标签: ionic-framework ionic2 ionic3


    【解决方案1】:

    因为您已将&lt;ion-toolbar&gt; 放在&lt;ion-header&gt; 中,这会将其定位在屏幕的顶部(标题)。请查看离子工具栏docs

    尝试将其放在&lt;ion-content&gt; 中。

    <ion-content>
    
      <ion-toolbar>
        <ion-title>this is the toolbar ...</ion-title>
      </ion-toolbar>
    
    </ion-content>
    

    【讨论】:

    • @JoséRamírez 那么你能把它标记为正确答案吗?
    • 我认为这不是最好的答案,这会使标题受离子内容的滚动区域影响。如果您希望将标题锁定在标签栏下,我认为这是不正确的。如果我找到更好的解决方案,我会回来发布它。
    猜你喜欢
    • 1970-01-01
    • 2018-01-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多