Shorter solution:
Vue.directive('select2', { inserted(el) { $(el).on('select2:select', () => { const event = new Event('change', { bubbles: true, cancelable: true }); el.dispatchEvent(event); }); $(el).on('select2:unselect', () => { const event = new Event('change', {bubbles: true, cancelable: true}) el.dispatchEvent(event) }) }, });
Trae's answer is good, but the value is already stored in the select element, so all you have to do is send an event so that Vue knows that we changed it.
Just do:
<select v-model="myprop" v-select2> ...
source share