From: Evan You Date: Wed, 8 Jul 2020 15:56:47 +0000 (-0400) Subject: fix(runtime-core): should allow v-model listeners to fallthrough, but ignore for... X-Git-Tag: v3.0.0-beta.20~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=903e8f697e4377e0ae92e1a6b58777438fba3610;p=thirdparty%2Fvuejs%2Fcore.git fix(runtime-core): should allow v-model listeners to fallthrough, but ignore for warning fix #1543 --- diff --git a/packages/runtime-core/src/componentProps.ts b/packages/runtime-core/src/componentProps.ts index 0eaed8c2d7..73aaec26b4 100644 --- a/packages/runtime-core/src/componentProps.ts +++ b/packages/runtime-core/src/componentProps.ts @@ -256,11 +256,7 @@ function setFullProps( let camelKey if (options && hasOwn(options, (camelKey = camelize(key)))) { props[camelKey] = value - } else if ( - (!emits || !isEmitListener(emits, key)) && - // ignore v-model listeners - !key.startsWith(`onUpdate:`) - ) { + } else if (!emits || !isEmitListener(emits, key)) { // 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 // original key casing diff --git a/packages/runtime-core/src/componentRenderUtils.ts b/packages/runtime-core/src/componentRenderUtils.ts index 9b07b3b413..41d44c53fc 100644 --- a/packages/runtime-core/src/componentRenderUtils.ts +++ b/packages/runtime-core/src/componentRenderUtils.ts @@ -121,8 +121,12 @@ export function renderComponentRoot( for (let i = 0, l = allAttrs.length; i < l; i++) { const key = allAttrs[i] if (isOn(key)) { - // remove `on`, lowercase first letter to reflect event casing accurately - eventAttrs.push(key[2].toLowerCase() + key.slice(3)) + // ignore v-model handlers when they fail to fallthrough + if (!key.startsWith('onUpdate:')) { + // remove `on`, lowercase first letter to reflect event casing + // accurately + eventAttrs.push(key[2].toLowerCase() + key.slice(3)) + } } else { extraAttrs.push(key) }