You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guide/advanced/composition-api.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,6 +7,8 @@ The introduction of `setup` and Vue's [Composition API](https://v3.vuejs.org/gui
7
7
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:
8
8
9
9
```js
10
+
import { useRouter, useRoute } from'vue-router'
11
+
10
12
exportdefault {
11
13
setup() {
12
14
constrouter=useRouter()
@@ -27,6 +29,8 @@ export default {
27
29
The `route` object is a reactive object, so any of its properties can be watched and you should **avoid watching the whole `route`** object:
0 commit comments