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