How to add two values within a v-select?

Asked

Viewed 79 times

-1

Ex:

let caracteristica = {
  id_caracteristica: 2,
  caracteristicas: "exCaracteristica"
}

<v-flex xs12 sm3 md6>
  <v-select
    v-model="selectdCaracteristica"
    label="Caracteristicas"
    :items="caracteristica"
    item-text="caracteristicas"
    item-value="caracteristicas"
  ></v-select>
</v-flex>

where I would fit the id_caracteristica?

1 answer

0


Your items should be an array containing the values that will be displayed in the list

inserir a descrição da imagem aqui

Can be an array of Objects or array of strings. When using Objects, will look for a text and value field. This can be changed using the item-text and item-value props. Objects that have a header or Divider Property are considered special cases and generate a list header or Divider; These items are not selectable.


Translating:

It can be an object array or string array. When using objects, will search for a text field and value. This can be changed using the item-text and item-value property. Objects that have a header property or splitter are considered special cases and generate a list header or divider; these items are not selectable.

Notice that I put inside [], you can place more items by calling the method .push() with the new object.

let caracteristica = [{
  id_caracteristica: 2,
  caracteristicas: "exCaracteristica"
}]

<v-flex xs12 sm3 md6>
  <v-select
    v-model="selectdCaracteristica"
    label="Caracteristicas"
    :items="caracteristica"
    item-text="caracteristicas"
    item-value="caracteristicas"
  ></v-select>
</v-flex>

Maybe you can use the id_caracteristica in the item-value, thus the value of the property would be used in v-model

Browser other questions tagged

You are not signed in. Login or sign up in order to post.