mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
the tab who loved me
This commit is contained in:
@ -27,8 +27,6 @@ export class NavBase {
|
||||
injector: Injector
|
||||
) {
|
||||
|
||||
console.log('NavBase, parent NavBase:', parentNavBase);
|
||||
|
||||
this.compiler = compiler;
|
||||
this.elementRef = elementRef;
|
||||
this.domElement = elementRef.domElement;
|
||||
@ -45,11 +43,8 @@ export class NavBase {
|
||||
this.childIds = -1;
|
||||
}
|
||||
|
||||
initial(initial) {
|
||||
console.log('initial')
|
||||
if (initial) {
|
||||
this.push(initial);
|
||||
}
|
||||
initial(ComponentClass) {
|
||||
this.push(ComponentClass);
|
||||
}
|
||||
|
||||
setPaneAnchor(elementRef) {
|
||||
@ -198,10 +193,12 @@ export class NavBase {
|
||||
}
|
||||
|
||||
select(enteringItem, opts = {}) {
|
||||
if (!enteringItem || this.isTransitioning()) {
|
||||
if (!enteringItem || !enteringItem.instance || this.isTransitioning()) {
|
||||
return;
|
||||
}
|
||||
|
||||
enteringItem.instance.loadInitial();
|
||||
|
||||
opts.animation = 'none';
|
||||
|
||||
let leavingItem = this.getActive() || new NavItem();
|
||||
@ -442,15 +439,24 @@ export class NavBase {
|
||||
return null;
|
||||
}
|
||||
|
||||
findByInstance(instance) {
|
||||
for (let i = 0, ii = this.items.length; i < ii; i++) {
|
||||
if (this.items[i].instance === instance) {
|
||||
return this.items[i];
|
||||
getByInstance(instance) {
|
||||
if (instance) {
|
||||
for (let i = 0, ii = this.items.length; i < ii; i++) {
|
||||
if (this.items[i].instance === instance) {
|
||||
return this.items[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
getByIndex(index) {
|
||||
if (index < this.items.length && index > -1) {
|
||||
return this.items[index];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
getPrevious(item) {
|
||||
if (item) {
|
||||
return this.items[ this.items.indexOf(item) - 1 ];
|
||||
@ -493,10 +499,6 @@ export class NavBase {
|
||||
return this.items.length;
|
||||
}
|
||||
|
||||
isActive(item) {
|
||||
return (item && item.state === ACTIVE_STATE);
|
||||
}
|
||||
|
||||
clear() {
|
||||
let pops = [];
|
||||
for (let item of this.items) {
|
||||
@ -517,6 +519,14 @@ export class NavBase {
|
||||
return instances
|
||||
}
|
||||
|
||||
isActive(item) {
|
||||
return (item && item.state === ACTIVE_STATE);
|
||||
}
|
||||
|
||||
isStagedEntering(item) {
|
||||
return (item && item.state === STAGED_ENTERING_STATE);
|
||||
}
|
||||
|
||||
width() {
|
||||
return this.domElement.offsetWidth;
|
||||
}
|
||||
|
Reference in New Issue
Block a user