javascriptjsonvue.jsvuetify.jsv-select

Vuetify v-select value not returning key


I am trying to v-model the keys from this data from my v-select :

{
data: {
IT: "Italy",
PL: "Poland",
AF: "Afghanistan",
AX: "Aland Islands",
AL: "Albania"
     }
}

My v-select and output look something like this (this is as close as i can get:

        {{ this.model[0] }}

        <v-select
        :items="Object.entries(this.items)"
        v-model="model"
        >
      </v-select>

The problem with this, is the value of the v-select will be "IT, Italy", when i just want Italy

I've been trying to work out ways, such as using a helper function to search the value and return a key, but i keep getting undefined, and wonder if there is an easier way of doing this. Or maybe converting the data to a new object.

If anyone has any ideas i would greatly appreciate it!


Solution

  • Thanks for your answer. I managed to get it to work without any helper functions:

      :items="items"
      item-value="[0]" 
      item-text="[1]"