mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
static tabs
This commit is contained in:
@@ -137,9 +137,6 @@ export class NavBase {
|
||||
// create a new NavStackItem
|
||||
let enteringItem = new NavItem(this, ComponentClass, params);
|
||||
|
||||
// set that this item is staged (it's not ready to be animated in yet)
|
||||
enteringItem.state = STAGED_STATE;
|
||||
|
||||
// add the item to the stack
|
||||
this.add(enteringItem);
|
||||
|
||||
@@ -541,11 +538,10 @@ export class NavBase {
|
||||
|
||||
}
|
||||
|
||||
const ACTIVE_STATE = 1;
|
||||
const CACHED_STATE = 2;
|
||||
const STAGED_ENTERING_STATE = 3;
|
||||
const STAGED_LEAVING_STATE = 4;
|
||||
const ACTIVELY_ENTERING_STATE = 5;
|
||||
const ACTIVELY_LEAVING_STATE = 6;
|
||||
|
||||
const STAGED_STATE = 'staged';
|
||||
const STAGED_ENTERING_STATE = 'staged-enter';
|
||||
const STAGED_LEAVING_STATE = 'staged-leave';
|
||||
const ACTIVELY_ENTERING_STATE = 'entering';
|
||||
const ACTIVELY_LEAVING_STATE = 'leaving';
|
||||
const ACTIVE_STATE = 'active';
|
||||
const CACHED_STATE = 'cached';
|
||||
|
||||
@@ -16,6 +16,7 @@ export class NavItem {
|
||||
this.ComponentClass = ComponentClass;
|
||||
this.params = params;
|
||||
this.instance = null;
|
||||
this.state = 0;
|
||||
|
||||
this._titleEle = undefined;
|
||||
this._backBtn = undefined;
|
||||
|
||||
@@ -53,11 +53,15 @@ export class Tab {
|
||||
|
||||
this.navBase = new NavBase(parentNavBase, compiler, elementRef, loader, injector);
|
||||
this.parentNavBase = parentNavBase;
|
||||
if (parentNavBase) {
|
||||
this.sections = parentNavBase.panes['_n'].sections;
|
||||
}
|
||||
|
||||
this.item = new NavItem(parentNavBase);
|
||||
this.item.setInstance(this);
|
||||
this.item.setViewElement(elementRef.domElement);
|
||||
tabs.add(this.item);
|
||||
this.tabs = tabs;
|
||||
|
||||
this.panelId = 'tab-panel-' + this.item.id;
|
||||
this.labeledBy = 'tab-button-' + this.item.id;
|
||||
@@ -66,7 +70,6 @@ export class Tab {
|
||||
|
||||
this.viewContainerRef = viewContainerRef;
|
||||
|
||||
this.sections = parentNavBase.panes['_n'].sections;
|
||||
this.navBase.panes['_n'] = this;
|
||||
|
||||
this.domElement = elementRef.domElement;
|
||||
@@ -74,7 +77,7 @@ export class Tab {
|
||||
}
|
||||
|
||||
onInit() {
|
||||
if ( this.parentNavBase.isActive(this.item) || this.parentNavBase.isStagedEntering(this.item) ) {
|
||||
if ( this.tabs.navBase.isActive(this.item) || this.tabs.navBase.isStagedEntering(this.item) ) {
|
||||
this.loadInitial();
|
||||
}
|
||||
}
|
||||
@@ -87,7 +90,7 @@ export class Tab {
|
||||
}
|
||||
|
||||
get isSelected() {
|
||||
return this.parentNavBase.isActive(this.item);
|
||||
return this.tabs.navBase.isActive(this.item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user