shentao / vue-multiselect

Universal select/multiselect/tagging component for Vue.js
https://vue-multiselect.js.org/
MIT License
6.73k stars 991 forks source link

Problem on tags after creating a new one #1473

Open luismabenitez opened 3 years ago

luismabenitez commented 3 years ago

When creating a new tag in a single select, the first option i get is to deselect the new option "Press enter to remove". So the user needs to click twice to make it selected.

Using with Vue 3.

<VueMultiselect :options="options" track-by="id" label="name" tag-placeholder="Add new item" :multiple="false" :taggable="true" :loading="isLoading" :searchable="true" :preserveSearch="true" @tag="addItem" @search-change="getItems" @select="selectDog" v-model="selected" :disabled="!breed" :clear-on-select="false" />

Captura de pantalla 2021-08-14 a las 15 27 17

I think the expected behavior should to be to select that item we are creating. isn't it?

lehoaibaokg commented 2 years ago

You can try to set the v-model on the addItem method. When pressing enter to create a new tag, it will be selected automatically.

akki-jat commented 2 years ago

@luismabenitez - Please provide reproduction link.