]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs(api): add route location normalized
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 14 Sep 2020 10:19:06 +0000 (12:19 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 14 Sep 2020 10:19:06 +0000 (12:19 +0200)
docs/api/index.md
docs/guide/advanced/navigation-guards.md
docs/guide/essentials/redirect-and-alias.md
docs/guide/migration/index.md
docs/index.md

index 0b516cd126b2a1dd49c54107f9bfd09696beef77..00ff48e6a0994d24bb3e793725a5480842880c2f 100644 (file)
@@ -752,12 +752,13 @@ Route record that can be provided by the user when adding routes via the [`route
 
 ### redirect
 
-- **Type**: [`RouteLocationRaw`](#routelocationraw) (Optional)
+- **Type**: `RouteLocationRaw | (to: RouteLocationNormalized) => RouteLocationRaw` (Optional)
 - **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.
+  before any navigation guard and triggers a new navigation with the new target
+  location. Can also be a function that receives the target route location and
+  returns the location we should redirect to.
 
 ### children
 
@@ -849,7 +850,7 @@ Normalized version of a [Route Record](#routerecordraw)
 - **Type**: `RouteMeta`
 - **Details**:
 
-  Arbitrary data attached to all matched records merged (non recursively) from parent to child.
+  Arbitrary data attached to the record.
 
 - **See also**: [Meta fields](/guide/advanced/meta.md)
 
@@ -918,6 +919,27 @@ Resolved [RouteLocationRaw](#routelocationraw) that can contain [redirect record
 
 Normalized route location. Does not have any [redirect records](#routerecordraw). In navigation guards, `to` and `from` are always of this type.
 
+### fullPath
+
+- **Type**: `string`
+- **Details**:
+
+  Encoded URL associated to the route location. Contains `path`, `query` and `hash`.
+
+### hash
+
+- **Type**: `string`
+- **Details**:
+
+  Decoded `hash` section of the URL. Always starts with a `#`. Empty string if there is no `hash` in the URL.
+
+### query
+
+- **Type**: `Record<string, string | string[]>`
+- **Details**:
+
+  Dictionary of decoded query params extracted from the `search` section of the URL.
+
 ### matched
 
 - **Type**: [`RouteRecordNormalized[]`](#routerecordnormalized)
@@ -925,6 +947,43 @@ Normalized route location. Does not have any [redirect records](#routerecordraw)
 
   Array of [normalized route records](#routerecord) that were matched with the given route location.
 
+### 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 | null`
+- **Details**:
+
+  Name for the route record. `undefined` if none was provided.
+
+### params
+
+- **Type**: `Record<string, string | string[]>`
+- **Details**:
+
+  Dictionary of decoded params extracted from `path`.
+
+### path
+
+- **Type**: `string`
+- **Details**:
+
+  Encoded `pathname` section of the URL associated to the route location.
+
+### redirectedFrom
+
+- **Type**: [`RouteLocation`](#routelocation)
+- **Details**:
+
+  Route location we were initially trying to access before ending up on the current location when a `redirect` option was found or a navigation guard called `next()` with a route location. `undefined` if there was no redirection.
+
 ## NavigationFailure
 
 ### from
index 8b422fcf689b8f877a289cee5b1e168c4d141279..53e557576de32a183a84ec540352119dc2bb701b 100644 (file)
@@ -86,7 +86,9 @@ 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.
+
+<!-- TODO: how to combine with [`meta` fields](./meta.md) to create a [generic fetching mechanism](#TODO). -->
 
 ## Global After Hooks
 
index 2b89d71896daa2ed5963514fd7b7712060fc3d22..c44f26666c2ef21ec6e4b7d2e4763f47c8da1d29 100644 (file)
@@ -98,4 +98,4 @@ const routes = [
 ]
 ```
 
-TODO: canonical links in cookbook https://support.google.com/webmasters/answer/139066?hl=en
+**Note about SEO**: when using aliases, make sure to define canonical links: https://support.google.com/webmasters/answer/139066?hl=en.
index 2008d76b8eea374b45425625ad9534b40436c6b2..9e85c8a3b8adcb951cd8047a7eec9996f8032465 100644 (file)
@@ -188,7 +188,7 @@ try {
 
 ### Removal of `router.match` and changes to `router.resolve`
 
-Both `router.match`, and `router.resolve` have been merged together into `router.resolve` with a slightly different signature. [Refer to the API](#TODO) for more details.
+Both `router.match`, and `router.resolve` have been merged together into `router.resolve` with a slightly different signature. [Refer to the API](/api/#resolve) for more details.
 
 **Reason**: Uniting multiple methods that were use for the same purpose.
 
index 6b0397e82220117afebe0e224e1087e6d2ebc65a..836d2177897e200dd5fb04677df677ebf312c47a 100644 (file)
@@ -13,6 +13,4 @@ Vue Router is the official router for [Vue.js](http://vuejs.org). It deeply inte
 - Customizable Scroll Behavior
 - Proper encoding for URLs
 
-<!-- TODO: provide examples or remove this -->
-
 [Get started](./guide/) or play with the [playground](https://github.com/vuejs/vue-router-next/tree/master/playground) (see [`README.md`](https://github.com/vuejs/vue-router-next) to run them).