ionic tab bar operations
ion-tabs
ion-tabs is a tab bar composed of a set of page tabs. You can switch pages by clicking on the options.
For iOS, it will appear at the bottom of the screen, and for Android, it will appear at the top of the screen (below the navigation bar).
Usage
<ion-tabs class="tabs-positive tabs-icon-only"> <ion-tab title="首页" icon-on="ion-ios7-filing" icon-off="ion-ios7-filing-outline"> <!-- 标签 1 内容 --> </ion-tab> <ion-tab title="关于" icon-on="ion-ios7-clock" icon-off="ion-ios7-clock-outline"> <!-- 标签 2 内容 --> </ion-tab> <ion-tab title="设置" icon-on="ion-ios7-gear" icon-off="ion-ios7-gear-outline"> <!-- 标签 3 内容 --> </ion-tab> </ion-tabs>
The effect is as follows:
API
Attribute | Type | Details |
---|---|---|
(optional) | String
| This handler identifies the tabs with $ionicTabsDelegate |
Belongs to ionTabs
Contains a tab content. The content only exists in the given tab that is selected.
Each ionTab has its own browsing history.
Usage
<ion-tab title="Tab!" icon="my-icon" href="#/tab/tab-link" on-select="onTabSelected()" on-deselect="onTabDeselected()"> </ion-tab>
API
Type | Details | |
---|---|---|
String |
| The title of the tab. |
(optional) | String
| But when touched, the tab will jump to the link. |
(optional) | String
| The icon of the tab. If a value is given, it becomes the default value for ion-on and ion-off. |
(optional) | String
| The icon of the selected label. |
(optional) | String
| The icon of the unselected label. |
(optional) | Expression
| The badge on the tab (usually a number). |
(optional) | Expression
| The style of the micro-chapter on the tab (for example, tabs-positive). |
(optional) | Expression
| Fired when the tab is selected. |
(optional) | Expression
| Fires when the tab is unchecked. |
(optional) | Expression
| Normally, the tab will be selected when clicked. If ng-Click is set, it will not be selected. You can use $ionicTabsDelegate.select() to specify switching tabs.
Parameters | Type | Details |
---|---|---|
index | Number | Select the index of the tag. |
shouldChangeHistory (optional) | Boolean value | Whether this option should load the browsing history for this tab (if it exists) and use it, or just load the default page. Default is false. Tip: If an |
selectedIndex()
Return value: Value, the index of the selected tag, such as -1.
$getByHandle(handle)
Parameters | Type | Details |
---|---|---|
String
|
$ionicTabsDelegate.$getByHandle('my-handle').select(0);