fix(runtime-core): should allow v-model listeners to fallthrough, but ignore for warning

fix #1543
This commit is contained in:
Evan You 2020-07-08 11:56:47 -04:00
parent 1e90605c15
commit 903e8f697e
2 changed files with 7 additions and 7 deletions

View File

@ -256,11 +256,7 @@ function setFullProps(
let camelKey let camelKey
if (options && hasOwn(options, (camelKey = camelize(key)))) { if (options && hasOwn(options, (camelKey = camelize(key)))) {
props[camelKey] = value props[camelKey] = value
} else if ( } else if (!emits || !isEmitListener(emits, key)) {
(!emits || !isEmitListener(emits, key)) &&
// ignore v-model listeners
!key.startsWith(`onUpdate:`)
) {
// Any non-declared (either as a prop or an emitted event) props are put // Any non-declared (either as a prop or an emitted event) props are put
// into a separate `attrs` object for spreading. Make sure to preserve // into a separate `attrs` object for spreading. Make sure to preserve
// original key casing // original key casing

View File

@ -121,8 +121,12 @@ export function renderComponentRoot(
for (let i = 0, l = allAttrs.length; i < l; i++) { for (let i = 0, l = allAttrs.length; i < l; i++) {
const key = allAttrs[i] const key = allAttrs[i]
if (isOn(key)) { if (isOn(key)) {
// remove `on`, lowercase first letter to reflect event casing accurately // ignore v-model handlers when they fail to fallthrough
eventAttrs.push(key[2].toLowerCase() + key.slice(3)) if (!key.startsWith('onUpdate:')) {
// remove `on`, lowercase first letter to reflect event casing
// accurately
eventAttrs.push(key[2].toLowerCase() + key.slice(3))
}
} else { } else {
extraAttrs.push(key) extraAttrs.push(key)
} }