Answer the question
In order to leave comments, you need to log in
Why is transition animation not working for 1 element in vue.js?
I did everything according to this documentation, the transition does not work :(
I also made the transition a separate element, it did not help either. What is the reason?
Here is the code and a link to the sandbox: https://codepen.io/qpz_here/pen/vRqVYY
<div id="app">
<button v-on:click="show = !show">Анимация</button>
<section v-if="show" transition="fade"></section>
</div>
section {
width: 300px;
height: 300px;
background: #007aff;
}
button {
padding: 20px 10px;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
new Vue ({
el: '#app',
data: {
show: true,
}
})
Answer the question
In order to leave comments, you need to log in
I did everything according to this documentation ...
<section v-if="show" transition="fade"></section>
<transition name="fade">
<section v-if="show"></section>
</transition>
transition(name="fade")
section(v-if="show")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question