R
R
Richard Millie2019-11-05 23:13:13
JavaScript
Richard Millie, 2019-11-05 23:13:13

How to get selected data from v-select?

I have an array like this:

my_arr: [
        {
            name: "Adam",
            surname: "Brown",
        },
        {
            name: "Bruce",
            surname: "Lee",
        },
        {
            name: "Erl",
            surname: "Black",
        },]

I use it in my v-select, only name is displayed there
<v-select
                v-if="my_arr"
                class='multi_drop'
                :items="my_arr"
                item-text="name"
                item-value="surname"
                label="Select"
                multiple
              ></v-select>

How do I access the object that was selected in the menu? How to work further with the selected data? Those. if Adam was selected how to get Adam Brown in the ready array?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor, 2019-11-05
@IgorPI

v-model will solve your problem.

<v-col cols="12" sm="6">
          <v-select
            v-model="model"
            :items="states"
            label="Select"
            multiple
            chips
            hint="What are the target regions"
            persistent-hint
          ></v-select>
        </v-col>

...
data () {
    return {
      model: [],
    }
  }
...

M
Miki06, 2019-11-06
@Miki06

return-object property

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question