有人能帮我在vue.js中将一个方法从父组件传递给子组件吗?我一直尝试通过将方法作为prop传递来实现...
我的父组件代码片段:
methods: {
test: function () {
console.log('from test method')
}
}
<template>
<child-component test="test"><child-component>
</template>
子组件片段
created: {
this.test() //returns test is not a function
},
props: ['test']
有人能帮忙吗?
提前致谢!