From: Eduardo San Martin Morote Date: Wed, 2 Aug 2023 09:00:52 +0000 (+0200) Subject: docs: reorder example X-Git-Tag: v4.2.5~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98e9af6adbdd4497bbfa6965ec6cd5741c448007;p=thirdparty%2Fvuejs%2Frouter.git docs: reorder example --- diff --git a/netlify.toml b/netlify.toml index 17cb1132..798623f0 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,5 +1,6 @@ [build.environment] CHROMEDRIVER_SKIP_DOWNLOAD = "true" +NODE_VERSION = "18" [build] command = "pnpm run docs:build" diff --git a/packages/docs/api/interfaces/Router.md b/packages/docs/api/interfaces/Router.md index 0c8d92e2..ca15e504 100644 --- a/packages/docs/api/interfaces/Router.md +++ b/packages/docs/api/interfaces/Router.md @@ -100,6 +100,8 @@ function that removes the registered hook. `fn` +a function that removes the registered hook + ▸ (): `void` Add a navigation hook that is executed after every navigation. Returns a @@ -109,6 +111,8 @@ function that removes the registered hook. `void` +a function that removes the registered hook + **`Example`** ```js @@ -191,6 +195,8 @@ registered guard. `fn` +a function that removes the registered guard + ▸ (): `void` Add a navigation guard that executes before navigation is about to be @@ -202,6 +208,8 @@ registered guard. `void` +a function that removes the registered guard + **`Example`** ```js diff --git a/packages/router/src/errors.ts b/packages/router/src/errors.ts index 2039d436..773be27b 100644 --- a/packages/router/src/errors.ts +++ b/packages/router/src/errors.ts @@ -144,6 +144,9 @@ export function createRouterError( /** * Check if an object is a {@link NavigationFailure}. * + * @param error - possible {@link NavigationFailure} + * @param type - optional types to check for + * * @example * ```js * import { isNavigationFailure, NavigationFailureType } from 'vue-router' @@ -163,8 +166,6 @@ export function createRouterError( * } * }) * ``` - * @param error - possible {@link NavigationFailure} - * @param type - optional types to check for */ export function isNavigationFailure( error: any, diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index e3d2ed3e..1d6c6697 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -287,6 +287,9 @@ export interface Router { * navigation guards have been successful. Returns a function that removes the * registered guard. * + * @param guard - navigation guard to add + * @returns a function that removes the registered guard + * * @example * ```js * router.beforeResolve(to => { @@ -294,13 +297,16 @@ export interface Router { * }) * ``` * - * @param guard - navigation guard to add */ beforeResolve(guard: NavigationGuardWithThis): () => void + /** * Add a navigation hook that is executed after every navigation. Returns a * function that removes the registered hook. * + * @param guard - navigation hook to add + * @returns a function that removes the registered hook + * * @example * ```js * router.afterEach((to, from, failure) => { @@ -309,8 +315,6 @@ export interface Router { * } * }) * ``` - * - * @param guard - navigation hook to add */ afterEach(guard: NavigationHookAfter): () => void