Skip to main content
Version: v9

ion-nav

shadow

Navは、任意のコンポーネントをロードし、スタックに新しいコンポーネントを追加するためのスタンドアロンコンポーネントです。

Router Outletとは異なり、Navは特定のルーターに縛られることはありません。つまり、Navコンポーネントをロードし、他のコンポーネントをスタックにプッシュしても、アプリ全体のルーターには影響しない。例えば、新しいコンポーネントをion-navにプッシュして、URLが更新されることを期待するべきではありません。これは、アプリのURLに関連付けずに、独自のサブナビゲーションが必要なモーダルがあるような使用例に適しています。

note

ion-navはルーティングには使用されません。代わりに、Angular、React、およびVueのルーティングガイド、またはion-routerのバニラJavaScriptプロジェクト用ガイドを参照してください。

NavLinkは、Navと対話する際の簡素化されたAPIです。開発者はコンポーネントをカスタマイズしたり、コンポーネントのプロパティを渡したり、ルートアニメーションの方向を変更したり、ナビゲート時のカスタムアニメーションを定義したりすることができます。

Modal can use Nav to offer a linear navigation that is independent of the URL.

note

以下の例では、Navへの参照とパブリックメソッドAPIを使用してビューをプッシュおよびポップします。このレベルの細かいアクセスと制御が必要ない実装では、NavLinkを使用することをお勧めします。

Interfaces​

必須ではありませんが、このコンポーネントから発行される Ionic イベントでより強く型付けを行うために、CustomEvent インターフェースの代わりにこのインターフェースを使用することが可能です。

interface NavCustomEvent extends CustomEvent {
target: HTMLIonNavElement;
}

プロパティ​

animated​

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

animation​

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

root​

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

rootParams​

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

swipeGesture​

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

イベント​

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

メソッド​

canGoBack​

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

getActive​

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

getByIndex​

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

getLength​

Descriptionスタック内のビューの数を返します。
SignaturegetLength() => Promise<number>

getPrevious​

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

insert​

Description指定されたインデックスのナビゲーションスタックにコンポーネントを挿入します。これは、ナビゲーションスタックの任意の位置にコンポーネントを追加するのに便利です。
Signatureinsert<T extends NavComponent>(insertIndex: number, component: T, componentProps?: ComponentProps<T> | null, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>
ParametersinsertIndex: The index to insert the component at in the stack.
component: The component to insert into the navigation stack.
componentProps: Any properties of the component.
opts: The navigation options.
done: The transition complete function.

insertPages​

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

pop​

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

popTo​

Descriptionナビゲーションスタック内の特定のインデックスにポップします。
SignaturepopTo(indexOrViewCtrl: number | ViewController, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>
ParametersindexOrViewCtrl: The index or view controller to pop to.
opts: The navigation options.
done: The transition complete function.

popToRoot​

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

push​

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

removeIndex​

Description指定されたインデックスにあるコンポーネントをナビゲーションスタックから削除します。
SignatureremoveIndex(startIndex: number, removeCount?: number, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>
ParametersstartIndex: The number to begin removal at.
removeCount: The number of components to remove.
opts: The navigation options.
done: The transition complete function.

setPages​

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

setRoot​

Description現在のナビゲーションスタックのルートをコンポーネントに設定します。
SignaturesetRoot<T extends NavComponent>(component: T, componentProps?: ComponentProps<T> | null, opts?: NavOptions | null, done?: TransitionDoneFn) => Promise<boolean>
Parameterscomponent: The component to set as the root of the navigation stack.
componentProps: Any properties of the component.
opts: The navigation options.
done: The transition complete function.

CSS Shadow Parts​

No CSS shadow parts available for this component.

CSSカスタムプロパティ​

No CSS custom properties available for this component.

Slots​

No slots available for this component.