[Vuejs]-Dynamic V-Model with a V-For

0👍

Instead of having 2 different arrays, you can use the same persons object array to include the new email ID. Add 2 new properties for each object in persons array called newEmail and checked. Then you can use the same object to display

<li v-for="(person, index ) in persons" :key="person.id">
  {{person.email}}

  <input type="text" name="filters" v-model="person.newEmail" />
  <input type="checkbox" name="filters" v-model="person.checked" />

This way you can keep track of id as well as oldEmail

Leave a comment