下面我就为大家分享一篇vue 子组件向父组件传值方法,具有很好的参考价值,希望对大家有所帮助。
子组件注册触发事件,父组件注册 触发子组件事件后的方法写在method里面
父组件这么写
Do you like me? {{childWords}}
methods: { listenToMyBoy: function (somedata){ this.childWords = somedata } }
子组件component-a这么写
立即学习“前端免费学习笔记(深入)”;
methods: {
onClickMe: function(){
this.$emit('child-say',this.somedata);
}
}上面是我整理给大家的,希望今后会对大家有帮助。
相关文章:










