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
close #1001
  • Loading branch information
yyx990803 committed Apr 20, 2020
1 parent e954ba2 commit ab844fd
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 ab844fd

Please sign in to comment.