Closed superern closed 5 years ago
Hi @superern, Thanks for using this component
How do you change the checkbox now? are you using v-model
?
could you provide a code which shows what you intend to do?
To answer your questions.
I was looking for something like. @change.prevent, but this doesnt seem to work.
Anyhow, I was able to resolve this by returning a false to stop from changing its state then do an ajax request. then i only change state the checkbox on then method via updating the binded data model, in this case: active.
`<p-check class="flex-grow p-switch p-fill" color="success" name="activation" v-model="active" @change="toggle($event)"
{{ toggleLabel }}`
toggle(e){ this.active = !e; axios.get(this.toggleUrl) .then(response => this.active = response.data.active) .catch(error => console.log(error)); },
@change.prevent
doesn't work even in default checkbox inputs but @click.prevent
does
likewise you can use @click.native.prevent
in this component
this Codepen shows you an example
@hamed-ehtesham thank you so much! this is much cleaner!
You're welcome
I wanted to stop the event change then after only I get response from my ajax query will only change the checkbox.