]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs(api): fix links
authorEduardo San Martin Morote <posva13@gmail.com>
Wed, 9 Sep 2020 12:29:23 +0000 (14:29 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Wed, 9 Sep 2020 12:29:23 +0000 (14:29 +0200)
docs/api/index.md
docs/api/vue-router-interface.md
docs/guide/advanced/composition-api.md
docs/guide/advanced/lazy-loading.md
docs/guide/advanced/navigation-guards.md
docs/guide/migration/index.md

index 531270ff29049fa1495d7cf02b4f33b47e0ba24d..b06a823d34ecb1b62b195c4192cc2c63d0b1a38c 100644 (file)
@@ -417,15 +417,45 @@ export declare function onBeforeRouteUpdate(updateGuard: NavigationGuard): void
 
 ### useLink
 
-TODO:
+Returns everything exposed by the [`v-slot` API](#router-link-s-v-slot).
+
+**Signature:**
+
+```typescript
+export declare function useLink(props: RouterLinkOptions): {
+  route: ComputedRef<RouteLocationNormalized & { href: string }>,
+  href: ComputedRef<string>,
+  isActive: ComputedRef<boolean>,
+  isExactActive: ComputedRef<boolean>,
+  navigate: (event?: MouseEvent) => Promise(NavigationFailure | void),
+}
+```
+
+#### Parameters
+
+| Parameter | Type              | Description                                                                           |
+| --------- | ----------------- | ------------------------------------------------------------------------------------- |
+| props     | RouterLinkOptions | props object that can be passed to `<router-link>`. Accepts `Ref`s and `ComputedRef`s |
 
 ### useRoute
 
-TODO:
+Returns the current route location. Equivalent to using `$route` inside templates.
+
+**Signature:**
+
+```typescript
+export declare function userRoute(): RouteLocationNormalized
+```
 
 ### useRouter
 
-TODO:
+Returns the [router](#Router) instance. Equivalent to using `$router` inside templates.
+
+**Signature:**
+
+```typescript
+export declare function userRouter(): Router
+```
 
 ## TypeScript
 
index 5ad439f4b5ee2c790269cb0221a7bd5b1ac1f3a4..9e8cd147f70cdf6940963ea32b5152599f73a97d 100644 (file)
@@ -180,7 +180,7 @@ replace?: boolean;
 
 #### state
 
-State to save using the History API. This cannot contain any reactive values and some primitives like Symbols are forbidden. More info at TODO: link mdn
+State to save using the History API. This cannot contain any reactive values and some primitives like Symbols are forbidden. More info [on MDN](https://developer.mozilla.org/en-US/docs/Web/API/History/pushState#Parameters).
 
 **Signature:**
 
index 6d7637f28788fb8590aacb24f899b67ea2ae88c5..9f5f198b1c5fc6300268751a1f7f30ad3db11c9d 100644 (file)
@@ -76,11 +76,11 @@ export default {
 }
 ```
 
-Composition API guards can also be used anywhere, they don't have to be used directly on the route component as in-component guards.
+Composition API guards can also be used in any component rendered by `<router-view>`, they don't have to be used directly on the route component like in-component guards.
 
 ## `useLink`
 
-Vue Router exposes the internal behavior of RouterLink as a Composition API function. It gives access the same properties as the [`v-slot` API](#TODO):
+Vue Router exposes the internal behavior of RouterLink as a Composition API function. It gives access the same properties as the [`v-slot` API](/api/#router-link-s-v-slot):
 
 ```js
 import { RouterLink, useLink } from 'vue-router'
index 8dc88c12ea934bde984b7e0ecbd204696898573d..71bf16775ba3a925d0d9c06722beba4a1aedaf80 100644 (file)
@@ -2,10 +2,6 @@
 
 When building apps with a bundler, the JavaScript bundle can become quite large, and thus affect the page load time. It would be more efficient if we can split each route's components into a separate chunks, and only load them when the route is visited.
 
-<!-- TODO: fix links -->
-
-<!-- TODO: make it clear that this also works with other bundlers, not only with webpack -->
-
 Vue Router supports [dynamic imports](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import#Dynamic_Imports) out of the box, meaning you can replace static imports with dynamic ones:
 
 ```js
@@ -41,7 +37,7 @@ When using Babel, you will need to add the [syntax-dynamic-import](https://babel
 
 ## Grouping Components in the Same Chunk
 
-Sometimes we may want to group all the components nested under the same route into the same async chunk. To achieve that we need to use [named chunks](https://webpack.js.org/guides/code-splitting-async/#chunk-names) by providing a chunk name using a special comment syntax (requires webpack > 2.4):
+Sometimes we may want to group all the components nested under the same route into the same async chunk. To achieve that we need to use [named chunks](https://webpack.js.org/guides/code-splitting/#dynamic-imports) by providing a chunk name using a special comment syntax (requires webpack > 2.4):
 
 ```js
 const UserDetails = () =>
index 0a978cfbb900b0b5db498a38669406d137d24b2e..0ffae4cf959f2ac839a2895a08a21a246c167960 100644 (file)
@@ -66,7 +66,7 @@ router.beforeEach((to, from, next) => {
 
 ## Global Resolve Guards
 
-You can register a global guard with `router.beforeResolve`. This is similar to `router.beforeEach` because it triggers on **every navigation**, but resolve guards are called right before the navigation is confirmed, **after all in-component guards and async route components are resolved**. Here is an example that ensures the user has given access to the Camera for routes that [have defined a custom meta](#TODO) property `requiresCamera`:
+You can register a global guard with `router.beforeResolve`. This is similar to `router.beforeEach` because it triggers on **every navigation**, but resolve guards are called right before the navigation is confirmed, **after all in-component guards and async route components are resolved**. Here is an example that ensures the user has given access to the Camera for routes that [have defined a custom meta](./meta.md) property `requiresCamera`:
 
 ```js
 router.beforeResolve(async to => {
@@ -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](/cookbook/generic-data-fetching.md)
+`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 66447201837bb92a9ebe4c6ca39a1d106ab0366c..f749a638757d7cd1671d432a70e3ba5ace7f45fb 100644 (file)
@@ -6,11 +6,9 @@ Most of Vue Router API has remained unchanged during its rewrite from v3 (for Vu
 
 Some of new features to keep an eye on in Vue Router 4 include:
 
-<!-- TODO: links -->
-
-- Dynamic Routing
+- [Dynamic Routing](#TODO)
 - [Composition API](/guide/advanced/composition-api.md)
-- Custom History implementation
+<!-- - Custom History implementation -->
 
 ## Breaking Changes: Improvements
 
@@ -89,13 +87,13 @@ Note this will work if `path` was `/parent/` as the relative location `home` to
 
 Decoded values are now consistent no matter where the navigation is initiated (older browsers will still produce unencoded `path` and `fullPath`). The initial navigation should yield the same results as in-app navigations.
 
-Given any [normalized route location](#TODO):
+Given any [normalized route location](/api/#routelocationnormalized):
 
 - Values in `path`, `fullPath` are not decoded anymore. They will appear as provided by the browser (modern browsers provide them encoded). e.g. directly writing on the address bar `https://example.com/hello world` will yield the encoded version: `https://example.com/hello%20world` and both `path` and `fullPath` will be `/hello%20world`.
 - `hash` is now decoded, that way it can be copied over: `router.push({ hash: $route.hash })`.
 - When using `push`, `resolve` and `replace` and providing a `string` location or a `path` property in an object, **it must be encoded**. On the other hand, `params`, `query` and `hash` must be provided in its unencoded version.
 
-**Reason**: This allows to easily copy existing properties of a location when calling `router.push()` and `router.resolve()`. Learn more about encoding [in the cookbook](/cookbook/encoding.md).
+**Reason**: This allows to easily copy existing properties of a location when calling `router.push()` and `router.resolve()`. Learn more about encoding [in the cookbook](#TODO).
 
 ## Breaking Changes: API Changes
 
@@ -230,7 +228,7 @@ app.config.globalProperties.append = (path, pathToAppend) =>
 
 ### Removal of `event` and `tag` props in `<router-link>`
 
-Both `event`, and `tag` props have been removed from `<router-link>`. You can use the [`v-slot` API](#TODO) to fully customize `<router-link>`:
+Both `event`, and `tag` props have been removed from `<router-link>`. You can use the [`v-slot` API](/api/#router-link-s-v-slot) to fully customize `<router-link>`:
 
 ```html
 replace