]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): should allow v-model listeners to fallthrough, but ignore for...
authorEvan You <yyx990803@gmail.com>
Wed, 8 Jul 2020 15:56:47 +0000 (11:56 -0400)
committerEvan You <yyx990803@gmail.com>
Wed, 8 Jul 2020 15:56:47 +0000 (11:56 -0400)
fix #1543

packages/runtime-core/src/componentProps.ts
packages/runtime-core/src/componentRenderUtils.ts

index 0eaed8c2d7ee03218e2734199efb81abd00b1cbd..73aaec26b4d6b4e90a1b3ded88cade8571613401 100644 (file)
@@ -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
index 9b07b3b413b7e1bf3c03ec605c6b74afb67c23ff..41d44c53fc49e1347a82cfe703d4df2a2951a4a1 100644 (file)
@@ -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)
           }