子组件使用 emit 报warning:
Extraneous non-emits event listeners (chooseRadio) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. If the listener is intended to be a component custom event listener only, declare it using the "emits" option.

【错误代码】

【解决】在 defineEmits 写一下emit 的事件即可

文章讲述了在Vue中,当子组件接收到非emit事件监听器时会报warning。解决方法是在`defineEmits`选项中明确声明组件的自定义事件。

1万+

被折叠的 条评论
为什么被折叠?



