From d55e51ca5c91d81a08f68e29ab073f679cd975a9 Mon Sep 17 00:00:00 2001 From: Dennis Wissel Date: Fri, 25 Dec 2020 23:01:46 +0100 Subject: [PATCH] docs: add imports (#677) --- docs/guide/advanced/composition-api.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/guide/advanced/composition-api.md b/docs/guide/advanced/composition-api.md index fcd6e331..a004e3a9 100644 --- a/docs/guide/advanced/composition-api.md +++ b/docs/guide/advanced/composition-api.md @@ -7,6 +7,8 @@ The introduction of `setup` and Vue's [Composition API](https://v3.vuejs.org/gui 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: ```js +import { useRouter, useRoute } from 'vue-router' + export default { setup() { const router = useRouter() @@ -27,6 +29,8 @@ export default { The `route` object is a reactive object, so any of its properties can be watched and you should **avoid watching the whole `route`** object: ```js +import { useRoute } from 'vue-router' + export default { setup() { const route = useRoute() -- 2.47.3