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
Since the `<router-view>` is essentially a dynamic component, we can apply transition effects to it the same way using the `<transition>` component:
4
+
5
+
```html
6
+
<transition>
7
+
<router-view></router-view>
8
+
</transition>
9
+
```
10
+
11
+
[Everything about `<transition>`](http://vuejs.org/guide/transitions.html) works the same here.
12
+
13
+
### Per-Route Transition
14
+
15
+
The above usage will apply the same transition for all routes. If you want each route's component to have different transitions, you can instead use `<transition>` with different names inside each route component:
16
+
17
+
```js
18
+
constFoo= {
19
+
template:`
20
+
<transition name="slide">
21
+
<div class="foo">...</div>
22
+
</transition>
23
+
`
24
+
}
25
+
26
+
constBar= {
27
+
template:`
28
+
<transition name="fade">
29
+
<div class="bar">...</div>
30
+
</transition>
31
+
`
32
+
}
33
+
```
34
+
35
+
### Route-Based Dynamic Transition
36
+
37
+
It is also possible to determine the transition to use dynamically based on the relationship between the target route and current route:
38
+
39
+
```html
40
+
<!-- use a dynamic transition name -->
41
+
<transition:name="transitionName">
42
+
<router-view></router-view>
43
+
</transition>
44
+
```
45
+
46
+
```js
47
+
// then, in the parent component,
48
+
// watch the $route to determine the transition to use
0 commit comments