I am a beginner with Vue and I'm exploring the possibilities of v-model
. My goal is to create an array of editable names. Below is the code I have been working on:
var app = new Vue({
el: '#app',
data: {
names: ['Josh', 'Tom']
}
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.3/vue.min.js"></script>
<div id="app">
Editable list:
<ul>
<li v-for="name in names"><input type="text" v-model="name"></li>
</ul>
{{ names }}
</div>
Although the inputs display correctly and show the expected values, updating them does not reflect changes in the names
array as it should. What could be causing this issue?