perkola
7595
23
Vue

Vue.js acces parent methods

Posted 3 years ago by perkola

I have a Vue object tied to a div and within that div i have a component. From the component I want to access methods of the parent. The child component contains buttons with handlers that should call methods from the parent.

<div id="parent">
    <child-component></child-component>
</div>

I've found out that the parent can be accessed via vm.$parent but when i try to call a method like vm.$parent.someParentMethod() I get undefined... Any tips?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.