[Vuejs]-Vue.js: property or method is not defined on the instance, but it is

2👍

foo would need to be defined in the component using my-component, not in my-component itself.

Also, you’d need to do @click.native, unless you’re specifically $emiting an event called click in my-component.

If you were to use @click="foo" inside of this component on an html element it would work like you expect (a @click on a component needs .native).

Leave a comment