mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 03:32:21 +08:00
commit of code
This commit is contained in:
@ -26,8 +26,8 @@ import {IonicComponent} from 'ionic/config/component';
|
||||
hostProperties: {
|
||||
'panelId': 'attr.id',
|
||||
'labeledBy': 'attr.aria-labelledby',
|
||||
'ariaHidden': 'attr.aria-hidden',
|
||||
'isSelected': 'class.show-tab'
|
||||
'!isSelected': 'attr.aria-hidden',
|
||||
'isSelected': 'class.tab-selected'
|
||||
},
|
||||
hostAttributes: {
|
||||
'role': 'tabpanel'
|
||||
@ -58,7 +58,6 @@ export class Tab {
|
||||
this.navBase.panes['_n'] = this;
|
||||
|
||||
this.isSelected = false;
|
||||
this.ariaHidden = true;
|
||||
|
||||
tabs.addTab(this);
|
||||
this.panelId = 'tab-panel-' + this.id;
|
||||
@ -83,7 +82,6 @@ export class Tab {
|
||||
}
|
||||
|
||||
this.isSelected = shouldSelect;
|
||||
this.ariaHidden = !shouldSelect;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ export class Tabs {
|
||||
this.id = ++tabsId;
|
||||
this.tabIds = 0;
|
||||
this.tabs = [];
|
||||
this._selected = null;
|
||||
|
||||
this.domElement = elementRef.domElement;
|
||||
this.config = Tabs.config.invoke(this);
|
||||
@ -75,6 +76,8 @@ export class Tabs {
|
||||
}
|
||||
if (!tabToSelect || this._selected === tabToSelect) return;
|
||||
|
||||
let tabToDeselect = this._selected;
|
||||
|
||||
this.tabs.forEach(tab => {
|
||||
tab.select( (tab === tabToSelect) );
|
||||
});
|
||||
|
@ -4,7 +4,13 @@
|
||||
<ion-tab [initial]="tab1Initial" tab-title="Tab 1">
|
||||
</ion-tab>
|
||||
|
||||
<ion-tab [initial]="tab2Initial" tab-title="Tab 2">
|
||||
<ion-tab [initial]="tab2Initial" tab-title="Tab 2" class="tab2">
|
||||
</ion-tab>
|
||||
|
||||
</ion-tabs>
|
||||
|
||||
<style>
|
||||
.tab2 f {
|
||||
background: green
|
||||
}
|
||||
</style>
|
||||
|
Reference in New Issue
Block a user