hamed-ehtesham / pretty-checkbox-vue

Quickly integrate pretty checkbox components with Vue.js
MIT License
261 stars 31 forks source link

Add support for @click #7

Closed daniel-stelle closed 5 years ago

daniel-stelle commented 6 years ago

Right now, putting a @click or v-on:click doesn't run the function that it is passed. I'm not sure if this was intended or not, but there are many circumstances where an on click handler is useful/needed.

hamed-ehtesham commented 6 years ago

Hi daniel thanks for your suggestion but why don't you use @change or v-on:change instead?

anyway i intended to make the components just like html default inputs and if that @click is supported in them i will add that feature as soon as possible

hamed-ehtesham commented 6 years ago

Hi i found this conversation which is related to our case here https://github.com/vuejs/vue/issues/3253 as @AnsonHwang86 suggests there, you can use .native modifier if you need listen to click event and @change isn't suitable for your specific use case

reppair commented 5 years ago

Cheers Hamed! I use the checkbox to make an ajax request. @click.native is exactly what I used to disable the event.target for the time of the request being processed and re-enable it later having the result of the request. It's nice because the checkbox now represents the exact state of the model.attribute in the database :)