[Vuejs]-Mustache result is not updated

0👍

You could achieve the desired behavior with a short code by using Using v-model on Components

Vue.component('list-entry', {
  'template': `<input type="text" :value="value" @input="$emit('input', $event.target.value)" />`,
  props: ['value'],
})

new Vue({
  el: "#app",
  data: () => ({
    texts: [
      'Foo', 'Bar', 'Baz'
    ]
  }),

})
input {
  display: block;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>

<div id="app">
  <div class='container'>
    <list-entry v-for="(t, idx) in texts" :key="idx" v-model="texts[idx]"></list-entry>
  </div>
  {{ texts }}
</div>

Leave a comment