Upon clicking the button, a multiselect menu pops up. However, on a second click, the true/false values quickly flash and the isOpen status remains true. What could be causing this issue?
Here is the template:
<div id="app">
<button @click="toggle">open and close later
</button>
<pre>{{ isOpen }}</pre>
<multiselect
ref="multiselect"
v-model="value"
:options="options"
:multiple="true"
track-by="library"
:custom-label="customLabel"
@close="isOpen = false"
@open="isOpen = true"
>
</multiselect>
</div>
This is the JavaScript code:
new Vue({
components: {
Multiselect: window.VueMultiselect.default
},
data: {
isOpen: false,
value: { language: 'JavaScript', library: 'Vue-Multiselect' },
options: [
{ language: 'JavaScript', library: 'Vue.js' },
{ language: 'JavaScript', library: 'Vue-Multiselect' },
{ language: 'JavaScript', library: 'Vuelidate' }
]
},
methods: {
toggle () {
if (this.isOpen) {
this.$refs.multiselect.$el.blur();
this.isOpen = false;
}
else {
this.$refs.multiselect.$el.focus();
this.isOpen = true;
}
}
}
}).$mount('#app')
You can view the example here: https://jsfiddle.net/46s5aknt/