Skip to content

Commit a11b04f

Browse files
committed
docs: key + transition
Close #867 Close #854 Close #803
1 parent 34fb9f9 commit a11b04f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/guide/advanced/transitions.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,17 @@ router.afterEach((to, from) => {
6868
})
6969
```
7070

71+
## Forcing a transition between reused views
72+
73+
Vue might automatically reuse components that look alike, avoiding any transition. Fortunately, it is possible [to add a `key` attribute](https://v3.vuejs.org/api/special-attributes.html#key) to force transitions. This also allows you to trigger transitions while staying on the same route with different params:
74+
75+
```vue
76+
<router-view v-slot="{ Component, route }">
77+
<transition name="fade">
78+
<component :is="Component" :key="route.path" />
79+
</transition>
80+
</router-view>
81+
```
82+
7183
<!-- TODO: interactive example -->
7284
<!-- See full example [here](https://github.com/vuejs/vue-router/blob/dev/examples/transitions/app.js). -->

0 commit comments

Comments
 (0)