Skip to content

Commit 4881642

Browse files
committed
Vue router view transition
1 parent b325069 commit 4881642

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/App.vue

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
<Header></Header>
55

66
<!-- Render Active Component Contents Start -->
7-
<router-view />
7+
<transition name="fade" mode="out-in">
8+
<router-view :theme="appTheme" />
9+
</transition>
810

911
<!-- Footer Start -->
1012
<Footer></Footer>
@@ -42,4 +44,37 @@ export default {
4244
-moz-osx-font-smoothing: grayscale;
4345
text-align: center;
4446
}
47+
48+
.fade-enter-active {
49+
animation: coming 0.4s;
50+
animation-delay: 0.2s;
51+
opacity: 0;
52+
}
53+
54+
.fade-leave-active {
55+
animation: going 0.4s;
56+
}
57+
58+
@keyframes going {
59+
from {
60+
transform: translateX(0);
61+
}
62+
63+
to {
64+
transform: translateX(-10px);
65+
opacity: 0;
66+
}
67+
}
68+
69+
@keyframes coming {
70+
from {
71+
transform: translateX(-10px);
72+
opacity: 0;
73+
}
74+
75+
to {
76+
transform: translateX(0px);
77+
opacity: 1;
78+
}
79+
}
4580
</style>

0 commit comments

Comments
 (0)