Vue 错误集
(缓慢更新中…)
1, [Vue warn]: Extraneous non-emits event listeners (XXX) 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.
这是vue3才会遇到的问题
解决办法
<script>
export default {
emits:{"test"]
this.$emit("test")
}
</script>

本文探讨了Vue3中遇到的特定错误:当组件渲染片段或文本根节点时,无法自动继承非发射事件监听器的问题。文章提供了详细的解决步骤,包括如何通过声明emits选项来定义组件的自定义事件。
1万+





