In my Vue app I have a simple toggle which renders a list when active. The list should not appear/disappear instantly. I want to have a smooth slide down transition on render and a smooth slide up transition on hide.
The following code shows what I have so far, does someone know how to make it work?
new Vue({
el: '#app',
data: () => ({
isOpen: true,
}),
});
.expand-enter-active,
.expand-leave-active {
overflow: hidden;
transition: height .5s linear;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<button @click="isOpen = !isOpen">
is open: {{ isOpen }}
</button>
<transition name="expand">
<div v-if="isOpen">
<div>1</div>
<div>2</div>
<div>3</div>
</div>
</transition>
</div>