Vue3中监听子组件事件 - 父组件监听 官网
父组件监听子组件事件,需在子组件标签上使用v-on指令。 !-- 父组件 --template ChildComponent @customEvent="handleEvent" //templatescript setupimport ChildComponent from './ChildComponent.vue';const handleEvent = () = { console.log('接收到子组件事件'); // 运行结果:子组件触发customEvent事件时,打印信息};/script 父组件监听事件时,要确保方法名正确且已定义。