ionic 头部和底部


ion-header-bar

这个是固定在屏幕顶部的一个头部标题栏。如果给它加上\’bar-subheader\’ 这个样式,它就是副标题。

用法

<ion-header-bar align-title=\"left\">
  <div>
    <button ng-click=\"doSomething()\">Left Button</button>
  </div>
  <h1>Title!</h1>
  <div>
    <button>Right Button</button>
  </div>
</ion-header-bar>
<ion-content>
  Some content!
</ion-content>

API

属性 类型 描述
align-title

(optional)

string

这个是对齐 title 的。如果没有设置,它将会按照手机的默认排版(Ios的默认是居中,Android默认是居左)。它的值可以是 \’left\’,\’center\’,\’right\’。

no-tap-scroll

(optional)

boolean

默认情况下,头部标题栏在点击屏幕时内容会滚动到头部,可以将 no-tap-scroll 设置为 true 来禁止该动作。。它的值是布尔值(true/false)。


ion-footer-bar

知道了 ion-header-bar ,理解ion-footer-bar就轻松多啦!只是 ion-footer-bar 是在屏幕的底部。

用法

<ion-content>
  Some content!
</ion-content>
<ion-footer-bar align-title=\"left\">
  <div>
    <button>Left Button</button>
  </div>
  <h1>Title!</h1>
  <div ng-click=\"doSomething()\">
    <button>Right Button</button>
  </div>
</ion-footer-bar>

API

与 ion-header-bar 不同的是,ion-footer-bar 只有 align-title 这个 API。

属性 类型 描述
align-title

(optional)

string

这个是对齐 title 的。如果没有设置,它将会按照手机的默认排版(Ios的默认是居中,Android默认是居左)。它的值可以是 \’left\’,\’center\’,\’right\’。