[Vuejs]-Don't show selected option in vue-select

4👍

You can use computed:

computed: {
    items () {
      return this.options.filter(i => i.title !== this.selectedLang?.title)
    }
}

and then use these "items" as options in select

<v-select :options="items" label="title" class="select" v- 
     model="selectedLang">

0👍

If you’re looking multi-select, you can use the following,

<v-select multiple :options="getOptions" ... />

{{ selectedLang }} // Prints selected options
{
  data: {
    selectedLang: [],
    options: [
      { title: 'RU', img: require(...) },
      { title: 'KZ', img: require(...) }
    ]
  },
  computed: {
    getOptions() {
      return this.options.filter(option => !this.selectedLang.find(o => o.title === option.title))
    }
  }
}
👤Naren

Leave a comment