Sometimes, we want to fire an event when v-model changes in Vue.js.
In this article, we’ll look at how to fire an event when v-model changes in Vue.js.
How to fire an event when v-model changes in Vue.js?
To fire an event when v-model changes in Vue.js, we can use the @input
directive.
For instance, we write
<template>
<div>
<input @input="handleInput" />
</div>
</template>
to run handleInput
whenever the input value changes.
Conclusion
To fire an event when v-model changes in Vue.js, we can use the @input
directive.