[Vuejs]-Select2 value not updated

0👍

You can’t use v-model with vuex when using that component. You’ll need to handle the changing of the value yourself, and use :value for the binding capturing @input to determine when the value changes. Observe:

<select2 @input="updateBereiche"
         :options="bereiche"
         :value="bereichInput" 
         class="form-control">

Then you’re going to add a new method called updateBereiche

methods: {
  updateBereiche(value) {
      this.$store.commit('setBereichInput', value)
  }
}

Remove your setter, it’s not needed anymore.

Leave a comment