Skip to main content
Version: v6

ion-nav

shadow

Nav is a standalone component for loading arbitrary components and pushing new components on to the stack.

Unlike Router Outlet, Nav is not tied to a particular router. This means that if we load a Nav component, and push other components to the stack, they will not affect the app's overall router. This fits use cases where you could have a modal, which needs its own sub-navigation, without making it tied to the apps URL.

NavLink is a simplified API when interacting with Nav. Developers can customize the component, pass along component properties, modify the direction of the route animation or define a custom animation when navigating.

Interfaces

While not required, this interface can be used in place of the CustomEvent interface for stronger typing with Ionic events emitted from this component.

interface NavCustomEvent extends CustomEvent {
target: HTMLIonNavElement;
}

Properties

animated

Descriptiontrueの場合、コンポーネントの遷移をアニメーションで表現します。
Attributeanimated
Typeboolean
Defaulttrue

animation

Descriptionデフォルトでは、ion-nav はmode(ios または Material Design)に応じてページ間の遷移をアニメーション化します。しかし、このプロパティは AnimationBuilder 関数を使用して、独自の遷移を作成することができます。
Attributeundefined
Type((baseEl: any, opts?: any) => Animation) | undefined
Defaultundefined

root

DescriptionロードするルートNavComponent
Attributeroot
TypeFunction | HTMLElement | ViewController | null | string | undefined
Defaultundefined

rootParams

Descriptionルートコンポーネントの任意のパラメータ
Attributeundefined
Typeundefined | { [key: string]: any; }
Defaultundefined

swipeGesture

Descriptionナビコンポーネントがスワイプで戻ることができるようにする場合。
Attributeswipe-gesture
Typeboolean | undefined
Defaultundefined

Events

NameDescription
ionNavDidChangeナビのコンポーネントが変更されたときに発生するイベント
ionNavWillChangeナビコンポーネントが変更されたときに発生するイベント

Methods

canGoBack

Description現在のビューが戻ることができる場合は true を返します。
SignaturecanGoBack(view?: ViewController) => Promise<boolean>

getActive

Descriptionアクティブビューを取得します。
SignaturegetActive() => Promise<ViewController | undefined>

getByIndex

Description指定されたインデックスにあるビューを取得します。
SignaturegetByIndex(index: number) => Promise<ViewController | undefined>

getPrevious

Description前のビューを取得します。
SignaturegetPrevious(view?: ViewController) => Promise<ViewController | undefined>

insert

Description指定されたインデックスのナビゲーションスタックにコンポーネントを挿入します。これは、ナビゲーションスタックの任意の位置にコンポーネントを追加するのに便利です。
Signatureinsert<T extends NavComponent>(insertIndex: number, component: T, componentProps?: ComponentProps<T> | null, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>

insertPages

Description指定されたインデックスのナビゲーションスタックにコンポーネントの配列を挿入します。配列の最後のコンポーネントはビューとしてインスタンス化され、アニメーションしてアクティブビューになります。
SignatureinsertPages(insertIndex: number, insertComponents: NavComponent[] | NavComponentWithProps[], opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>

pop

Descriptionナビゲーションスタックからコンポーネントをポップオフします。現在のコンポーネントからナビゲートして戻る。
Signaturepop(opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>

popTo

Descriptionナビゲーションスタック内の特定のインデックスにポップします。
SignaturepopTo(indexOrViewCtrl: number | ViewController, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>

popToRoot

Descriptionスタックのルートまで戻ってナビゲートする、それがどんなに遠くても。
SignaturepopToRoot(opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>

push

Description新しいコンポーネントを現在のナビゲーションスタックにプッシュします。追加情報があれば、オブジェクトとして一緒に渡す。この追加情報には、NavParamsからアクセスできます。
Signaturepush<T extends NavComponent>(component: T, componentProps?: ComponentProps<T> | null, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>

removeIndex

Description指定されたインデックスにあるコンポーネントをナビゲーションスタックから削除します。
SignatureremoveIndex(startIndex: number, removeCount?: number, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>

setPages

Description現在のナビゲーションスタックのビューを設定し、最後のビューにナビゲートします。デフォルトではアニメーションは無効になっていますが、ナビゲーションコントローラーにオプションを渡すことで有効にすることができます。ナビゲーションパラメーターは、配列内の各ページに渡すこともできます。
SignaturesetPages(views: NavComponent[] | NavComponentWithProps[], opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>

setRoot

Description現在のナビゲーションスタックのルートをコンポーネントに設定します。
SignaturesetRoot<T extends NavComponent>(component: T, componentProps?: ComponentProps<T> | null, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>

CSS Shadow Parts

No CSS shadow parts available for this component.

CSS Custom Properties

No CSS custom properties available for this component.

Slots

No slots available for this component.