I'm using Vuetify to render a combobox, when the user change the value of that combobox I want to display a message asking to confirm the operation, but I'm not able to prevent the change of the value if the user disagree to change the value. I tried with both input
and change
events.
Below the HTML:
<v-app>
<v-container class="indigo lighten-5">
<v-row no-gutters>
<v-col cols="12">
<v-select v-model="o.selected" :items="values" @input="inputSelect"></v-select>
</v-col>
</v-row>
</v-container>
</v-app>
while the methods that listens for changes is:
inputSelect(val) {
console.log(val);
if (confirm(`Do you really want to change the value to ${val}?`)) {
console.log("ok");
return true;
} else {
console.log("ko");
return false;
}
}
I created a pen to reproduce the behavior.