Skip to content

Commit 7e08a66

Browse files
committed
docs(api): fix links
1 parent 53efea2 commit 7e08a66

File tree

6 files changed

+44
-20
lines changed

6 files changed

+44
-20
lines changed

docs/api/index.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,15 +417,45 @@ export declare function onBeforeRouteUpdate(updateGuard: NavigationGuard): void
417417

418418
### useLink
419419

420-
TODO:
420+
Returns everything exposed by the [`v-slot` API](#router-link-s-v-slot).
421+
422+
**Signature:**
423+
424+
```typescript
425+
export declare function useLink(props: RouterLinkOptions): {
426+
route: ComputedRef<RouteLocationNormalized & { href: string }>,
427+
href: ComputedRef<string>,
428+
isActive: ComputedRef<boolean>,
429+
isExactActive: ComputedRef<boolean>,
430+
navigate: (event?: MouseEvent) => Promise(NavigationFailure | void),
431+
}
432+
```
433+
434+
#### Parameters
435+
436+
| Parameter | Type | Description |
437+
| --------- | ----------------- | ------------------------------------------------------------------------------------- |
438+
| props | RouterLinkOptions | props object that can be passed to `<router-link>`. Accepts `Ref`s and `ComputedRef`s |
421439

422440
### useRoute
423441

424-
TODO:
442+
Returns the current route ___location. Equivalent to using `$route` inside templates.
443+
444+
**Signature:**
445+
446+
```typescript
447+
export declare function userRoute(): RouteLocationNormalized
448+
```
425449

426450
### useRouter
427451

428-
TODO:
452+
Returns the [router](#Router) instance. Equivalent to using `$router` inside templates.
453+
454+
**Signature:**
455+
456+
```typescript
457+
export declare function userRouter(): Router
458+
```
429459

430460
## TypeScript
431461

docs/api/vue-router-interface.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ replace?: boolean;
180180
181181
#### state
182182
183-
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
183+
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).
184184
185185
**Signature:**
186186

docs/guide/advanced/composition-api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ export default {
7676
}
7777
```
7878

79-
Composition API guards can also be used anywhere, they don't have to be used directly on the route component as in-component guards.
79+
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.
8080

8181
## `useLink`
8282

83-
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):
83+
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):
8484

8585
```js
8686
import { RouterLink, useLink } from 'vue-router'

docs/guide/advanced/lazy-loading.md

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22

33
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.
44

5-
<!-- TODO: fix links -->
6-
7-
<!-- TODO: make it clear that this also works with other bundlers, not only with webpack -->
8-
95
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:
106

117
```js
@@ -41,7 +37,7 @@ When using Babel, you will need to add the [syntax-dynamic-import](https://babel
4137

4238
## Grouping Components in the Same Chunk
4339

44-
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):
40+
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):
4541

4642
```js
4743
const UserDetails = () =>

docs/guide/advanced/navigation-guards.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ router.beforeEach((to, from, next) => {
6666

6767
## Global Resolve Guards
6868

69-
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`:
69+
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`:
7070

7171
```js
7272
router.beforeResolve(async to => {
@@ -86,7 +86,7 @@ router.beforeResolve(async to => {
8686
})
8787
```
8888

89-
`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)
89+
`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)
9090

9191
## Global After Hooks
9292

docs/guide/migration/index.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,9 @@ Most of Vue Router API has remained unchanged during its rewrite from v3 (for Vu
66

77
Some of new features to keep an eye on in Vue Router 4 include:
88

9-
<!-- TODO: links -->
10-
11-
- Dynamic Routing
9+
- [Dynamic Routing](#TODO)
1210
- [Composition API](/guide/advanced/composition-api.md)
13-
- Custom History implementation
11+
<!-- - Custom History implementation -->
1412

1513
## Breaking Changes: Improvements
1614

@@ -89,13 +87,13 @@ Note this will work if `path` was `/parent/` as the relative ___location `home` to
8987

9088
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.
9189

92-
Given any [normalized route ___location](#TODO):
90+
Given any [normalized route ___location](/api/#routelocationnormalized):
9391

9492
- 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`.
9593
- `hash` is now decoded, that way it can be copied over: `router.push({ hash: $route.hash })`.
9694
- 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.
9795

98-
**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).
96+
**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).
9997

10098
## Breaking Changes: API Changes
10199

@@ -230,7 +228,7 @@ app.config.globalProperties.append = (path, pathToAppend) =>
230228

231229
### Removal of `event` and `tag` props in `<router-link>`
232230

233-
Both `event`, and `tag` props have been removed from `<router-link>`. You can use the [`v-slot` API](#TODO) to fully customize `<router-link>`:
231+
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>`:
234232

235233
```html
236234
replace

0 commit comments

Comments
 (0)