Reputation: 13721
Can someone help me with passing a method from a parent to a child component in vue.js? I've been trying to do it by passing the method in as a prop...
My parent component snippet:
methods: {
test: function () {
console.log('from test method')
}
}
<template>
<child-component test="test"><child-component>
</template>
Child component snippet
created: {
this.test() //returns test is not a function
},
props: ['test']
Can someone help?
Thanks in advance!
Upvotes: 21
Views: 32251