父组件:
<child ref="xxx"></child>
methods: {
test(value){
},
},
mounted() {
this.$refs.xxx.$on('haha', this.test);
}
子组件:
<button @click="send(value)"></button>
send(value) {
this.$emit('haha',value);
}
父组件:
<child ref="xxx"></child>
methods: {
test(value){
},
},
mounted() {
this.$refs.xxx.$on('haha', this.test);
}
子组件:
<button @click="send(value)"></button>
send(value) {
this.$emit('haha',value);
}