Reputation: 39
I'm in the process of learning Vue but I'm having some (basic) issues.
I'm trying to call a method that's defined in the component, when the component renders. For that I'm using the created
hook, but I'm getting this in the console: Uncaught ReferenceError: myMethod is not defined
.
My component javascript looks like this:
export default {
name: 'MyComponent',
methods: {
myMethod: function () {
console.log("asd123")
}
},
created: myMethod()
}
If it's relevant for my issue: the component in question is getting rendered through vue-router
.
Upvotes: 0
Views: 177