]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat(runtime-core): more specific warning for failed v-on fallthrough
authorEvan You <yyx990803@gmail.com>
Mon, 20 Apr 2020 19:32:21 +0000 (15:32 -0400)
committerEvan You <yyx990803@gmail.com>
Mon, 20 Apr 2020 19:32:21 +0000 (15:32 -0400)
close #1001

packages/runtime-core/src/componentRenderUtils.ts

index 1074edf9dc0d129c60c57f6ddeef1c828a9bc487..3a9f8d888c790eeb948d1ac3e8429380e5c35f20 100644 (file)
@@ -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.`
+              : ``)
         )
       }
     }