Skip to content

Commit d55e51c

Browse files
authored
docs: add imports (vuejs#677)
1 parent 1e58574 commit d55e51c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

docs/guide/advanced/composition-api.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ The introduction of `setup` and Vue's [Composition API](https://v3.vuejs.org/gui
77
Because we don't have access to `this` inside of `setup`, we cannot directly access `this.$router` or `this.$route` anymore. Instead we use the `useRouter` function:
88

99
```js
10+
import { useRouter, useRoute } from 'vue-router'
11+
1012
export default {
1113
setup() {
1214
const router = useRouter()
@@ -27,6 +29,8 @@ export default {
2729
The `route` object is a reactive object, so any of its properties can be watched and you should **avoid watching the whole `route`** object:
2830

2931
```js
32+
import { useRoute } from 'vue-router'
33+
3034
export default {
3135
setup() {
3236
const route = useRoute()

0 commit comments

Comments
 (0)