对于 VueJS 2.0 项目,我在父组件上有以下内容
<template>
<child></child>
<button @click="$emit('childEvent)"></button>
</template>
在我的子组件上:
{
events: { 'childEvent' : function(){.... },
ready() { this.$on('childEvent',...) },
methods: { childEvent() {....} }
}
点击按钮似乎没有任何效果。我是否需要创建一个父方法,然后将其发送给孩子?我使用的是 vuejs 1。但现在我对父子通信的工作方式感到困惑