I tried to have a checkbox with a @click.stop.prevent="myEvent"
that shall ask before setting the checkbox to true, but stop and prevent are ignored and the checkbox still gets activated. What might be wrong here?
Here is a fiddle with the described problem: https://jsfiddle.net/ag63f9fm/49/
<v-checkbox @click.native.stop.prevent='ask($event)' :label="`Checkbox 1: ${checkbox1.toString()}`" v-model="checkbox1"></v-checkbox>
the ask method:
ask: function (event) {
answer = confirm('really')
console.log('Answer: ' + answer)
if (!answer) {
event.stopPropagation()
event.preventDefault()
}
return answer
}
Specifically, we can use stop event modifier. . stop will stop the event propagation.
You should bind `disabled` prop to `false` for every control.
Okay, after posting an issue at vuetify I was told to use click.capture
instead, but I still don't know why a simple event.stopPropagation()
didn't work in the first place.
this code work fine:
<v-switch :input-value="checked" @click.native.capture="changeStatus($event)"></v-switch>
methods: {
changeStatus(event) {
event.stopPropagation()
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With