From ab844fd1692007cf2be4d01a9062caa36fa1d280 Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 20 Apr 2020 15:32:21 -0400 Subject: [PATCH] feat(runtime-core): more specific warning for failed v-on fallthrough close #1001 --- packages/runtime-core/src/componentRenderUtils.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/runtime-core/src/componentRenderUtils.ts b/packages/runtime-core/src/componentRenderUtils.ts index 1074edf9..3a9f8d88 100644 --- a/packages/runtime-core/src/componentRenderUtils.ts +++ b/packages/runtime-core/src/componentRenderUtils.ts @@ -107,11 +107,16 @@ export function renderComponentRoot( root.patchFlag |= PatchFlags.FULL_PROPS } } else if (__DEV__ && !accessedAttrs && root.type !== Comment) { + const hasListeners = Object.keys(attrs).some(isOn) warn( `Extraneous non-props attributes (` + `${Object.keys(attrs).join(', ')}) ` + `were passed to component but could not be automatically inherited ` + - `because component renders fragment or text root nodes.` + `because component renders fragment or text root nodes.` + + (hasListeners + ? ` If the v-on listener is intended to be a component custom ` + + `event listener only, declare it using the "emits" option.` + : ``) ) } }