Vue.js provides a built-in transition system. You can use the v-enter
, v-leave-to
, and other classes to define CSS transitions or animations.
<transition name="fade" mode="out-in">
<div :key="componentKey">Content</div>
</transition>
.fade-enter-active, .fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter, .fade-leave-to {
opacity: 0;
}