huan feng
huan feng

Reputation: 8623

Vuetify v-select how to call change only when user select an option?

Currently the v-select change event will fires multiple times during user typing keywords. Is there any event will be only fired if user has select an option or press Enter to select an option. I don't want the change event be fired during user typing keywords.

Upvotes: 2

Views: 1612

Answers (2)

Alexandr Guravskiy
Alexandr Guravskiy

Reputation: 131

      <v-select
        v-model="valueGender"
        :items="items"
        :rules="[v => !!v || 'Item is required']"
        label="gender"
        @update:modelValue="setSameCode('gender', valueGender)"
      ></v-select>

It work for me

Upvotes: 2

Joe Tripodi
Joe Tripodi

Reputation: 81

V-Select#Events

Unfortunately, it looks like the change event only has a parameter that is the value of selected option. There is not event passed through for you to check what actually raised the change event. However, looking at the link above, there are other events you can use.

There is a keydown event listed here that you might be able to leverage. It takes in a keyboard event, you should be able to check what keyboard event was raise i.e. 'Enter'. There are also other events such as mousedown or mouseup.

Upvotes: 1

Related Questions