<div id="app">
<button v-on:click="show = !show">
Toggle
</button>
<transition
enter-class="opacity-0"
leave-to-class="opacity-0"
enter-active-class="trs-time-3"
leave-active-class="trs-time-3"
>
<div class="box" v-if="show"></div>
</transition>
</div>
button {
margin-bottom: 10px;
}
.box {
width: 100px;
height: 100px;
background-color: #303E51;
}
.opacity-0 {
opacity: 0;
}
.trs-time-3 {
transition-duration: 3s;
}
const vm = new Vue({
el: '#app',
data: {
show: true,
},
});