Despite my efforts, I can't seem to get this seemingly simple task to work. I came across a question on Stack Overflow that seemed to address the issue - how to fire an event when v-model changes
Here is the component that I am working with:
<template>
<div>
<input type="text" v-model="searchTerm" v-on:change="search" />
</div>
</template>
<script>
export default {
data() {
return {
searchTerm: ''
}
},
methods: {
search() {
console.log(this.searchTerm);
}
}
}
</script>
I'm aiming to log the updated searchTerm every time a user types in the input field, but for some reason nothing appears in the console. Am I missing something here? Is this not the correct way to listen for v-model changes in nuxt?