Vue Select Multiple Allow Same Option Selection for Vue 3

1.3k Views Asked by At

Is it possible to allow same option selection using Vue Select library? Let's say I have 2 options Canada and United States, then wanted to select that option many times. That would be like: enter image description here

<v-select multiple v-model="selected" :options="['Canada','United States']" />

Also tried Vue-multiselect library, but it seems that the custom selection template is not working for Vue 3 with version ^3.0.0-alpha.2. This is the repository for Vue 3 compatability. Meanwhile, the code below is for version 2:

<multiselect v-model="value" :options="options" :multiple="true" :close-on-select="false" :clear-on-select="false" :preserve-search="true" placeholder="Pick some" label="name" track-by="name" :preselect-first="true">
    <template slot="selection" slot-scope="{ values, search, isOpen }">
        <span class="multiselect__single" v-if="values.length && !isOpen">{{ values.length }} options selected</span>
    </template>
</multiselect>

How to achieve this behavior?

0

There are 0 best solutions below