Vue3中 子组件通过emit抛出事件 出现如下警告但不影响使用

Vue3使用中,子传父时,抛出警告,虽然不影响使用,但是能去掉最好,解决方案

Extraneous non-emits event listeners (accept) 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.
at <HelloWorld aaa="父传子" onAccept=fn<accepted> >
at <App>

加入emits  将事件抛出来即可

 

 

posted @ 2022-08-10 09:22  沁猿春  阅读(1419)  评论(0编辑  收藏  举报