3

I'm trying to find a way to add a new value using v-select previously not in the list. So that the new value entered will become the selected option.

This is my current code:

        <v-select
          ref="systemSelect"
          v-model="reservation.system"
          name="system"
          label="Select System"
          :disabled="isBusy"
          :options="systems"
          @input="getSystems"
        />

In UI the component looks like this. Here I use Vuex only to get :options. Currently if I enter a new value and click outside that value disappears since its not found in the list

enter image description here

Expected: Would like to enter a new value and use this value as current in the form and save it. Is there a way to achieve this?

Any help would be appreciated.
Thanks!

user10368959
  • 155
  • 3
  • 14

1 Answers1

4

If you're using vue select, you can use the attribute taggable and multiple to push your own options:

<v-select taggable multiple />

See this link:

https://vue-select.org/guide/values.html#tagging

  • This does not work as using `multiple` creates a list instead of selecting a single value. Thanks for the suggestion tho – user10368959 Jun 18 '19 at 23:26
  • ended up using Bootstrap-vue's datalist component instead which allows this – user10368959 Jun 18 '19 at 23:27
  • 3
    FYI - you don't have to use `multiple` with `taggable` - I successfully set up a single-select that allowed unmatched user entries (also using the remote options w/ infinite scroll). – user9645 Aug 10 '21 at 14:46