I want to add some transition effect on newly created element on VueJS. Like in the following code if I create a new list element using the input field, I want it to appear using 'fade' or 'slide-in' effect. I couldn't figure out it from the official documentation. how can I do that?
var vm = new Vue({
el: "#vue-instance",
data: {
newelement: '',
list: []
},
methods: {
addelement: function() {
this.list.push(this.newelement);
this.newelement = '';
}
}
});
<div id="vue-instance">
<input type="text" v-model="newelement" @keyup.enter="addelement">
<ul v-for="element in list">
<li>{{ element }}</li>
</ul>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>
<ul v-for="element in list" transition="fade">try in that way, it should work. According to docs "The transition attribute can be used together with: v-for (triggered for insertion and removal only)"