0
You have made mistake in data: {},
it should be in data(){...}
:
new Vue({
el: "#app",
data() {},
methods: {
filterChanged() {
console.log("You changed the filter");
}
}
});
Here is the working sandbox for your code:
0
I found that when there was something else changing the radio button (eg. radio button being set via a prop() or something) rather than a true human click, the change event wasn’t actually fired.
If you set @click()
instead of @change()
see if that helps it start firing.
Your code does look correct though, so if you can get JS to not fire it, then that’s most ideal.
- [Vuejs]-How to make notifications float and right aligned in css vuejs
- [Vuejs]-Getting 'currently unable to handle this request' error when rendering inertia component in Laravel 8 with vue.js
-3
Agree with Aaron, it’s a function you’re calling, so use: filterChanged()
Also, try using v-on:click="filterChanged()"
In theory, that shouldn’t make a difference, but I’ve found that can help sometimes.
- [Vuejs]-Vuejs conditionally Redirect after post based on store data
- [Vuejs]-Vue.js 2.0 and Meteor JS
Source:stackexchange.com