0👍
Make sure you’re using the key attribute. Otherwise, vue will try to re-use existing dom elements, which may lead to the weird behavior you’re seeing.
=> it works: https://jsfiddle.net/adrienjoly/Lb3yqdso/8/ 🤓
<p v-for="input, i in inputs">
<autosizing-textarea :key="input.key" :value="input.text"></autosizing-textarea>
</p>
new Vue({
el: '#demo',
data: { inputs: [{ key:0 }] },
methods: {
add: function() {
this.inputs.unshift({ key: this.inputs.length });
},
},
})
Source:stackexchange.com