Skip to content

Commit 5b8e033

Browse files
committed
docs: normalize links
1 parent 72986cb commit 5b8e033

File tree

2 files changed

+5
-31
lines changed

2 files changed

+5
-31
lines changed

docs/guide/advanced/navigation-guards.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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](/cookbook/generic-data-fetching.md)
9090

9191
## Global After Hooks
9292

@@ -98,7 +98,7 @@ router.afterEach((to, from) => {
9898
})
9999
```
100100

101-
They are useful for analytics, [changing the title of the page](../../cookbook/page-title.md), [accessibility](../../cookbook/announcing-navigation.md) and many other things.
101+
They are useful for analytics, [changing the title of the page](/cookbook/page-title.md), [accessibility](/cookbook/announcing-navigation.md) and many other things.
102102

103103
They also reflect [navigation failures](./navigation-failures.md) as the third argument:
104104

docs/guide/index.md

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ const router = VueRouter.createRouter({
6363
})
6464

6565
// 4. Create and mount the root instance.
66+
const app = Vue.createApp({})
6667
// Make sure to _use_ the router instance to make the
6768
// whole app router-aware.
68-
const app = Vue.createApp({})
6969
app.use(router)
7070

7171
app.mount('#app')
7272

7373
// Now the app has started!
7474
```
7575

76-
By injecting the router, we get access to it as `this.$router` as well as the current route as `this.$route` inside of any component:
76+
By calling `app.use(router)`, we get access to it as `this.$router` as well as the current route as `this.$route` inside of any component:
7777

7878
```js
7979
// Home.vue
@@ -96,32 +96,6 @@ export default {
9696
}
9797
```
9898

99-
To access the router or the route inside the `setup` function, call the `useRouter` or `useRoute` functions:
100-
101-
```js
102-
// Home.vue
103-
const { computed } = Vue
104-
const { useRouter, useRoute } = VueRouter
105-
106-
export default {
107-
setup() {
108-
const router = useRouter()
109-
const route = useRoute()
110-
111-
const username = computed(() => route.params.username)
112-
function goToDashboard() {
113-
if (isAuthenticated) {
114-
router.push('/dashboard')
115-
} else {
116-
router.push('/login')
117-
}
118-
}
119-
120-
return { username, goToDashboard }
121-
},
122-
}
123-
```
124-
125-
We will learn more about this in [the Composition API](/guide/advanced/composition-api.md)
99+
To access the router or the route inside the `setup` function, call the `useRouter` or `useRoute` functions. We will learn more about this in [the Composition API](/guide/advanced/composition-api.md#accessing-the-router-and-current-route-inside-setup)
126100

127101
Throughout the docs, we will often use the `router` instance. Keep in mind that `this.$router` is exactly the same as directly using the `router` instance created through `createRouter`. The reason we use `this.$router` is because we don't want to import the router in every single component that needs to manipulate routing.

0 commit comments

Comments
 (0)