Sometimes, we want to watch click events from a checkbox with Vue.js.
In this article, we’ll look at how to watch click events from a checkbox with Vue.js.
How to watch click events from a checkbox with Vue.js?
To watch click events from a checkbox with Vue.js, we can watch the change event.
For instance, we write
<template>
<input
type="checkbox"
:value="mainCat.merchantId"
v-model="checkedCategories"
@change="check"
/>
</template>
to watch the change event on the checkbox with @change="check".
Then check will run when we check or uncheck the checkbox.
Conclusion
To watch click events from a checkbox with Vue.js, we can watch the change event.