]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs(api): fix links
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 14 Sep 2020 09:56:53 +0000 (11:56 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 14 Sep 2020 09:56:53 +0000 (11:56 +0200)
docs/api/index.md
docs/api/vue-router-interface.md [deleted file]
docs/api/vue-router-typealias.md [deleted file]
docs/guide/advanced/navigation-guards.md
docs/guide/essentials/dynamic-matching.md
docs/guide/essentials/navigation.md
docs/guide/essentials/redirect-and-alias.md
docs/guide/migration/index.md

index 04c6e503a45fedbe71c79d35b598530c4a6f6e86..0b516cd126b2a1dd49c54107f9bfd09696beef77 100644 (file)
@@ -4,9 +4,6 @@ sidebar: auto
 
 # API Reference
 
-- [Interfaces](./vue-router-interface.md)
-- [Types](./vue-router-typealias.md)
-
 ## `<router-link>` Props
 
 ### to
@@ -813,6 +810,77 @@ Route record that can be provided by the user when adding routes via the [`route
 
 - **See Also**: [Meta fields](/guide/advanced/meta.md)
 
+## RouteRecordNormalized
+
+Normalized version of a [Route Record](#routerecordraw)
+
+### aliasOf
+
+- **Type**: `RouteRecordNormalized | undefined`
+- **Details**:
+
+  Defines if this record is the alias of another one. This property is `undefined` if the record is the original one.
+
+### beforeEnter
+
+- **Type**: [`NavigationGuard`](#navigationguard)
+- **Details**:
+
+  Navigation guard applied when entering this record from somewhere else.
+
+- **See Also**: [Navigation guards](/guide/advanced/navigation-guards.md)
+
+### children
+
+- **Type**: Array of normalized [route records](#routerecordnormalized)
+- **Details**:
+
+  Children route records of the current route. Empty array if none.
+
+### components
+
+- **Type**: `Record<string, Component>`
+- **Details**:
+
+  Dictionary of named views, if none, contains an object with the key `default`.
+
+### meta
+
+- **Type**: `RouteMeta`
+- **Details**:
+
+  Arbitrary data attached to all matched records merged (non recursively) from parent to child.
+
+- **See also**: [Meta fields](/guide/advanced/meta.md)
+
+### name
+
+- **Type**: `string | symbol | undefined`
+- **Details**:
+
+  Name for the route record. `undefined` if none was provided.
+
+### path
+
+- **Type**: `string`
+- **Details**:
+
+  Normalized path of the record. Includes any parent's `path`.
+
+### props
+
+- **Type**: `Record<string, boolean | Function | Record<string, any>>`
+- **Details**:
+
+  Dictionary of the [`props` option](#props) for each named view. If none, it will contain only one property named `default`.
+
+### redirect
+
+- **Type**: [`RouteLocationRaw`](#routelocationraw)
+- **Details**:
+
+  Where to redirect if the route is directly matched. The redirection happens before any navigation guard and triggers a new navigation with the new target location.
+
 ## RouteLocationRaw
 
 User-level route location that can be passed to `router.push()`, `redirect`, and returned in [Navigation Guards](/guide/advanced/navigation-guards.md).
@@ -852,7 +920,10 @@ Normalized route location. Does not have any [redirect records](#routerecordraw)
 
 ### matched
 
-Array of [normalized route records](#routerecord).
+- **Type**: [`RouteRecordNormalized[]`](#routerecordnormalized)
+- **Details**:
+
+  Array of [normalized route records](#routerecord) that were matched with the given route location.
 
 ## NavigationFailure
 
diff --git a/docs/api/vue-router-interface.md b/docs/api/vue-router-interface.md
deleted file mode 100644 (file)
index b766d47..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-# Interface
-
-## RouteRecordNormalized
-
-Normalized version of a [Route Record](./vue-router-typealias#routerecord)
-
-**Signature:**
-
-```typescript
-export interface RouteRecordNormalized
-```
-
-### Methods
-
-### Properties
-
-#### aliasOf
-
-Defines if this record is the alias of another one. This property is `undefined` if the record is the original one.
-
-**Signature:**
-
-```typescript
-aliasOf: RouteRecordNormalized | undefined
-```
-
-#### beforeEnter
-
-**Signature:**
-
-```typescript
-beforeEnter: RouteRecordMultipleViews['beforeEnter']
-```
-
-#### children
-
-**Signature:**
-
-```typescript
-children: Exclude<_RouteRecordBase['children'], void>;
-```
-
-#### components
-
-**Signature:**
-
-```typescript
-components: RouteRecordMultipleViews['components']
-```
-
-#### instances
-
-Mounted route component instances Having the instances on the record mean beforeRouteUpdate and beforeRouteLeave guards can only be invoked with the latest mounted app instance if there are multiple application instances rendering the same view, basically duplicating the content on the page, which shouldn't happen in practice. It will work if multiple apps are rendering different named views.
-
-**Signature:**
-
-```typescript
-instances: Record<string, ComponentPublicInstance | undefined | null>;
-```
-
-#### meta
-
-Arbitrary data attached to the record.
-
-**Signature:**
-
-```typescript
-meta: Exclude<_RouteRecordBase['meta'], void>;
-```
-
-#### name
-
-Name for the route record.
-
-**Signature:**
-
-```typescript
-name: _RouteRecordBase['name']
-```
-
-#### path
-
-Path of the record. Should start with `/` unless the record is the child of another record.
-
-**Signature:**
-
-```typescript
-path: _RouteRecordBase['path']
-```
-
-#### props
-
-**Signature:**
-
-```typescript
-props: Record<string, _RouteRecordProps>;
-```
-
-#### redirect
-
-Where to redirect if the route is directly matched. The redirection happens before any navigation guard and triggers a new navigation with the new target location.
-
-**Signature:**
-
-```typescript
-redirect: _RouteRecordBase['redirect'] | undefined
-```
-
-### Methods
-
-### Properties
-
-#### name
-
-#### route
-
-## ScrollBehavior_2
-
-### Methods
-
-### Properties
diff --git a/docs/api/vue-router-typealias.md b/docs/api/vue-router-typealias.md
deleted file mode 100644 (file)
index 1844195..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# TypeAlias
-
-## RouteRecord
-
-Normalized version of a [Route Record](./vue-router-typealias#routerecord)
-
-**Signature:**
-
-```typescript
-export declare type RouteRecord = RouteRecordNormalized
-```
-
-## RouteRecordRaw
index 0ffae4cf959f2ac839a2895a08a21a246c167960..8b422fcf689b8f877a289cee5b1e168c4d141279 100644 (file)
@@ -86,7 +86,7 @@ router.beforeResolve(async to => {
 })
 ```
 
-`router.beforeResolve` is the ideal spot to fetch data or do any other operation that you want to avoid doing if the user cannot enter a page. It's also very easy to combine with [`meta` fields](./meta.md) to create a [generic fetching mechanism](#TODO)
+`router.beforeResolve` is the ideal spot to fetch data or do any other operation that you want to avoid doing if the user cannot enter a page. It's also very easy to combine with [`meta` fields](./meta.md) to create a [generic fetching mechanism](#TODO).
 
 ## Global After Hooks
 
index f99edfdad05d1d020c562a6b47c6a324ff2f408f..ed192b8e10cf8aa44cc2a35ca5df5df433e26aab 100644 (file)
@@ -74,16 +74,25 @@ const User = {
 Regular params will only match characters in between url fragments, separated by `/`. If we want to match **anything**, we can use a custom _param_ regexp by adding the regexp inside parentheses right after the _param_:
 
 ```js
-{
+const routes = [
   // will match everything and put it under `$route.params.pathMatch`
-  path: '/:pathMatch(.*)'
-}
-{
+  { path: '/:pathMatch(.*)*', name: 'NotFound' },
   // will match anything starting with `/user-` and put it under `$route.params.afterUser`
-  path: '/user-:afterUser(.*)'
-}
+  { path: '/user-:afterUser(.*)' },
+]
 ```
 
+In this specific scenario we are using a [custom regexp](/guide/advanced/path-matching.md#custom-regexp) between parentheses and marking the `pathMatch` param as [optionally repeatable](/guide/advanced/path-matching.md#zero-or-more). This is to allows us to directly navigate to the route if we need to by splitting the `path` into an array:
+
+```js
+this.$router.push({
+  name: 'NotFound',
+  params: { pathMatch: this.$route.path.split('/') },
+})
+```
+
+See more in the [repeated params](/guide/advanced/path-matching.md#zero-or-more) section.
+
 If you are using [History mode](./history-mode.md), make sure to follow the instructions to correctly configure your server as well.
 
 ## Advanced Matching Patterns
index 3d0fd921a6dfc35f931a1ec8d4bef32913cb2ad4..12c89007d2c81df012bf69e85d60973cb14a38bb 100644 (file)
@@ -98,4 +98,4 @@ You may have noticed that `router.push`, `router.replace` and `router.go` are co
 
 Therefore, if you are already familiar with [Browser History APIs](https://developer.mozilla.org/en-US/docs/Web/API/History_API), manipulating history will feel familiar when using Vue Router.
 
-It is worth mentioning that Vue Router navigation methods (`push`, `replace`, `go`) work consistently no matter the kind of [`history` option](#TODO_api_or_custom_history) is passed when creating the router instance.
+It is worth mentioning that Vue Router navigation methods (`push`, `replace`, `go`) work consistently no matter the kind of [`history` option](/api/#history) is passed when creating the router instance.
index f44a0029d53a6f5aaa2110ae801f76f643db3c30..2b89d71896daa2ed5963514fd7b7712060fc3d22 100644 (file)
@@ -25,12 +25,12 @@ const routes = [
       // the function receives the target route as the argument
       // we return a redirect path/location here.
       return { path: '/search', query: { q: to.params.searchText } }
-    }
+    },
   },
   {
-    path: '/search'
+    path: '/search',
     // ...
-  }
+  },
 ]
 ```
 
@@ -47,8 +47,8 @@ const routes = [
     redirect: to => {
       // the function receives the target route as the argument
       // return redirect path/location here.
-    }
-  }
+    },
+  },
 ]
 ```
 
@@ -75,9 +75,9 @@ const routes = [
       // - /users
       // - /users/list
       // - /people
-      { path: '', component: UserList, alias: ['/people', 'list'] }
-    ]
-  }
+      { path: '', component: UserList, alias: ['/people', 'list'] },
+    ],
+  },
 ]
 ```
 
@@ -92,14 +92,10 @@ const routes = [
       // - /users/24
       // - /users/24/profile
       // - /24
-      { path: 'profile', component: UserDetails, alias: ['/:id', ''] }
-    ]
-  }
+      { path: 'profile', component: UserDetails, alias: ['/:id', ''] },
+    ],
+  },
 ]
 ```
 
 TODO: canonical links in cookbook https://support.google.com/webmasters/answer/139066?hl=en
-
-<!-- TODO: add the advanced usage here as well -->
-
-For advanced usage, check out the [example](https://github.com/vuejs/vue-router/blob/dev/examples/route-alias/app.js).
index 29de36897f1f1be18bdc0043b401fd075716ab58..2008d76b8eea374b45425625ad9534b40436c6b2 100644 (file)
@@ -318,6 +318,10 @@ history.replaceState(history.state, '', url)
 
 **Reason**: We use the history state to save information about the navigation like the scroll position, previous location, etc.
 
+### Navigation guards in mixins are ignored
+
+At the moment navigation guards in mixins are not supported. You can track its support at [vue-router#454](https://github.com/vuejs/vue-router-next/issues/454).
+
 ### TypeScript
 
 To make typings more consistent and expressive, some types have been renamed: