[Vuejs]-Using object as Vue Select options

0👍

There are multiple ways you could do that but one options is:

<v-select v-model="obj.value" :options="obj.options" :reduce="val => val.code"/>

Only change to your data should be that the obj.options should look like below:

obj: {
    value: "en",
    options: [
      { label: "Arabic", code: "ar" },
      { label: "Asturian", code: "ast" },
      { label: "English", code: "en" }
    ]
  }

Relevant documentation transforming-selections

Leave a comment