Skip to content

Commit ab844fd

Browse files
committed
feat(runtime-core): more specific warning for failed v-on fallthrough
close #1001
1 parent e954ba2 commit ab844fd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/runtime-core/src/componentRenderUtils.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,16 @@ export function renderComponentRoot(
107107
root.patchFlag |= PatchFlags.FULL_PROPS
108108
}
109109
} else if (__DEV__ && !accessedAttrs && root.type !== Comment) {
110+
const hasListeners = Object.keys(attrs).some(isOn)
110111
warn(
111112
`Extraneous non-props attributes (` +
112113
`${Object.keys(attrs).join(', ')}) ` +
113114
`were passed to component but could not be automatically inherited ` +
114-
`because component renders fragment or text root nodes.`
115+
`because component renders fragment or text root nodes.` +
116+
(hasListeners
117+
? ` If the v-on listener is intended to be a component custom ` +
118+
`event listener only, declare it using the "emits" option.`
119+
: ``)
115120
)
116121
}
117122
}

0 commit comments

Comments
 (0)