I am working with a select element that interacts with my Vuex store:
<select v-model:value="leadTrackNumber" >
<option v-for="(track, index) in tracks ">{{ index }}</option>
</select>
Here is the corresponding method:
leadTrackNumber: {
get(){
// process some data
return leadTrackNumber
},
set(value){
this.$store.commit('updateLeadTrack', value )
},
},
I want to use something like
v-model:value="leadTrackNumber(value, $event)"
and then receive it in the method as set(value, event)
(although this code does not actually work). Is there a way to achieve this?
The goal is to utilize the received event
argument to blur the select element. (By using event.target.blur()
)
I am seeking an answer to this question out of curiosity, but I am also open to alternative methods. (For example, I can call a blur function on change like this: @change="blurFunction($event)"
, but that only works when the value changes - I want it to blur regardless.)