Skip to content

Commit

Permalink
feat(runtime-core): more specific warning for failed v-on fallthrough
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 authored and pikax committed Apr 29, 2020
1 parent 4115c11 commit ca09a4e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/runtime-core/src/componentRenderUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.`
: ``)
)
}
}
Expand Down

0 comments on commit ca09a4e

Please sign in to comment.