mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 22:17:40 +08:00
refactor(nav): update getActiveChildNavs to getChildNavs, publicly expose it
This commit is contained in:
@ -104,7 +104,7 @@ export class App {
|
|||||||
|
|
||||||
export function findTopNavs(nav: NavContainer): NavContainer[] {
|
export function findTopNavs(nav: NavContainer): NavContainer[] {
|
||||||
let containers: NavContainer[] = [];
|
let containers: NavContainer[] = [];
|
||||||
const childNavs = nav.getActiveChildNavs();
|
const childNavs = nav.getChildNavs();
|
||||||
if (!childNavs || !childNavs.length) {
|
if (!childNavs || !childNavs.length) {
|
||||||
containers.push(nav);
|
containers.push(nav);
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,11 +22,12 @@ export interface PublicNav {
|
|||||||
removeView(viewController: PublicViewController, opts?: NavOptions): Promise<any>;
|
removeView(viewController: PublicViewController, opts?: NavOptions): Promise<any>;
|
||||||
setPages(componentDataPairs: any[], opts?: NavOptions): Promise<any>;
|
setPages(componentDataPairs: any[], opts?: NavOptions): Promise<any>;
|
||||||
|
|
||||||
getActive?(): PublicViewController;
|
getActive(): PublicViewController;
|
||||||
getPrevious?(view?: PublicViewController): PublicViewController;
|
getPrevious(view?: PublicViewController): PublicViewController;
|
||||||
canGoBack?(): boolean;
|
canGoBack(): boolean;
|
||||||
canSwipeBack?(): boolean;
|
canSwipeBack(): boolean;
|
||||||
getFirstView?(): PublicViewController;
|
getFirstView(): PublicViewController;
|
||||||
|
getChildNavs(): PublicNav[];
|
||||||
|
|
||||||
element?: HTMLElement;
|
element?: HTMLElement;
|
||||||
}
|
}
|
||||||
@ -35,7 +36,7 @@ export interface NavContainer {
|
|||||||
id?: number;
|
id?: number;
|
||||||
name?: string;
|
name?: string;
|
||||||
parent?: Nav;
|
parent?: Nav;
|
||||||
getActiveChildNavs?(): NavContainer[];
|
getChildNavs?(): NavContainer[];
|
||||||
getAllChildNavs?(): NavContainer[];
|
getAllChildNavs?(): NavContainer[];
|
||||||
getType?(): string;
|
getType?(): string;
|
||||||
getSecondaryIdentifier?(): string;
|
getSecondaryIdentifier?(): string;
|
||||||
|
@ -6,6 +6,7 @@ import {
|
|||||||
ComponentDataPair,
|
ComponentDataPair,
|
||||||
Config,
|
Config,
|
||||||
FrameworkDelegate,
|
FrameworkDelegate,
|
||||||
|
NavContainer,
|
||||||
NavOptions,
|
NavOptions,
|
||||||
NavResult,
|
NavResult,
|
||||||
NavState,
|
NavState,
|
||||||
@ -60,7 +61,7 @@ const queueMap = new Map<number, TransitionInstruction[]>();
|
|||||||
tag: 'ion-nav',
|
tag: 'ion-nav',
|
||||||
styleUrl: 'nav.scss'
|
styleUrl: 'nav.scss'
|
||||||
})
|
})
|
||||||
export class Nav implements PublicNav {
|
export class Nav implements PublicNav, NavContainer {
|
||||||
|
|
||||||
@Element() element: HTMLElement;
|
@Element() element: HTMLElement;
|
||||||
@Event() navInit: EventEmitter;
|
@Event() navInit: EventEmitter;
|
||||||
@ -217,6 +218,11 @@ export class Nav implements PublicNav {
|
|||||||
return this.routes;
|
return this.routes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Method()
|
||||||
|
getChildNavs(): PublicNav[] {
|
||||||
|
return this.childNavs || [];
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <slot></slot>;
|
return <slot></slot>;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,9 @@ any
|
|||||||
#### getActive()
|
#### getActive()
|
||||||
|
|
||||||
|
|
||||||
|
#### getChildNavs()
|
||||||
|
|
||||||
|
|
||||||
#### getFirstView()
|
#### getFirstView()
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user