[Vuejs]-Multimple select2 with laravel vue js not working

0👍

you need to reload select2.

html markup:

<select class="form-control select2 @{{ index }}"  name="unit" v-model="pack.unit" id="unit">
  <option value="0">KG</option>
  <option value="1">ML</option>
  <option value="2">Liter</option>
</select>

Vuejs code:

...
components: {

},
mounted() {
  setTimeOut(() => {
    let unit = $('#unit'); // or document.querySelector('#unit');
    unit.select2();
  }, 100);
},

Leave a comment