javascript - Problem with route transition in vue?
滿天的星座
滿天的星座 2017-06-12 09:30:07
0
3
745

Vue adds a cutscene animation fade-in and fade-out effect to the route. The component fades out when it is removed, but when it is entered, it enters instantly and does not fade in. Between these two steps, the page will become blank. The following is my code, copied from the official website:

<template>
  <p id="app">
    <transition name="fade">
      <router-view></router-view>
    </transition>
  </p>
</template>
.fade-enter-active, .fade-leave-active {
  transition: opacity .3s
}
.fade-enter, .fade-leave-active {
  opacity: 0
}


请问要怎么做才可以在当前组件淡出的同时,将要被插入的组件能淡入。
滿天的星座
滿天的星座

reply all(3)
世界只因有你

Set mode to out-in

学霸
.fade-enter-active, .fade-leave-active {
  opacity: 1;
  transition: opacity .3s
}
.fade-enter, .fade-leave-active {
  opacity: 0
}

or:

.fade-enter-active, .fade-leave-active {
  opacity: 1;
  transition: opacity .3s
}
.fade-enter, .fade-leave-to {
  opacity: 0;
}
刘奇

.fade-enter-active, .fade-leave-active {
opacity: 1;
transition: opacity .3s
}
.fade-enter, .fade-leave {
opacity: 0
}

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!