From: Dennis Wissel Date: Fri, 25 Dec 2020 22:01:46 +0000 (+0100) Subject: docs: add imports (#677) X-Git-Tag: v4.0.2~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d55e51ca5c91d81a08f68e29ab073f679cd975a9;p=thirdparty%2Fvuejs%2Frouter.git docs: add imports (#677) --- 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()