0👍
this
property has access to your scope level properties because it’s a function and not an arrow function. So when you access the properties or method which is not in the scope of that function, it returns undefined or not a function.
To fix it, Make your success function as an arrow function
of Javascript.
success: (result) => {
this.$emit('update:pets', updated);
},
Another way is to remove the self inside the success method and use the outer self
.
success: function (result) {
self.$emit('update:pets', updated);
},
- [Vuejs]-'Cannot read property 'set' of undefined' Error For 'this.$cookies.set'
- [Vuejs]-Tailwindcss/vue: generated css file doesn't include custom classes from <style> section
Source:stackexchange.com