shentao / vue-multiselect

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

Value can be set to option which not exist #1622

Closed dkwebtec closed 1 year ago

dkwebtec commented 1 year ago

<VueMultiselect id="form-mkt" v-model="filter.mkt" :show-labels="false" :options="md.market.map(({ name }) => name)" />

I can set a value into filter,mkt which is not in options and it shows a pill with it. Component is not taggable.

akki-jat commented 1 year ago

@dkwebtec Why you are adding the value which is not available in options. If you are adding it manually then you should first check if that value is available in options or not.

dkwebtec commented 1 year ago

because the options are filtered by other dropdown.

md.market is changed by other dropdown but the filter.mkt stays set and some of these values are not in options anymore

akki-jat commented 1 year ago

because the options are filtered by other dropdown.

md.market is changed by other dropdown but the filter.mkt stays set and some of these values are not in options anymore

When md.market changes the reevaluate filter.mkt to remove any selection which is not in options anymore.

To do this you can use select event.

akki-jat commented 1 year ago

@dkwebtec Please reopen the issue again if still any concern for the same.