【发布时间】:2023-03-08 14:58:01
【问题描述】:
对于 VueJS 2.0 项目,我在父组件上有以下内容
<template>
<child></child>
<button @click="$emit('childEvent)"></button>
</template>
在我拥有的子组件上:
{
events: { 'childEvent' : function(){.... },
ready() { this.$on('childEvent',...) },
methods: { childEvent() {....} }
}
点击按钮似乎没有任何效果。我是否需要创建一个父方法,然后将其发送给孩子?我使用的是 vuejs 1。但现在我对父子通信的工作方式感到困惑
【问题讨论】:
标签: vue-component vue.js vuejs2