]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
docs: add imports (#677)
authorDennis Wissel <dsine-de@users.noreply.github.com>
Fri, 25 Dec 2020 22:01:46 +0000 (23:01 +0100)
committerGitHub <noreply@github.com>
Fri, 25 Dec 2020 22:01:46 +0000 (23:01 +0100)
docs/guide/advanced/composition-api.md

index fcd6e3311014174f5733edc90d43d672cf6c2b3e..a004e3a9cbd63ef43f2010eb887b211b13a77f0b 100644 (file)
@@ -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()