vue 子组件向父组件传值方法
发布时间:2020-12-17 02:33:58 所属栏目:百科 来源:网络整理
导读:子组件注册触发事件,父组件注册 触发子组件事件后的方法写在method里面 父组件这么写 Do you like me? {{childWords}} methods: { listenToMyBoy: function (somedata){ this.childWords = somedata } } 子组件component-a这么写 methods: { onClickMe: fun
子组件注册触发事件,父组件注册 触发子组件事件后的方法写在method里面 父组件这么写 Do you like me? {{childWords}} methods: { listenToMyBoy: function (somedata){ this.childWords = somedata } }子组件component-a这么写
methods: {
onClickMe: function(){
this.$emit('child-say',this.somedata);
}
}
以上这篇vue 子组件向父组件传值方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程之家。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |