]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
wip: fix props/attrs bugs
authorEvan You <evan@vuejs.org>
Fri, 6 Dec 2024 14:07:21 +0000 (22:07 +0800)
committerEvan You <evan@vuejs.org>
Fri, 6 Dec 2024 14:13:48 +0000 (22:13 +0800)
packages/runtime-vapor/src/componentProps.ts

index 9410982d9613d9b22ab7a68dad2225f12a65b01f..120c9d1398e73f90ddcfb7e78a0c7d0225a5542e 100644 (file)
@@ -39,16 +39,16 @@ export function getPropsProxyHandlers(
   }
   const propsOptions = normalizePropsOptions(comp)[0]
   const emitsOptions = normalizeEmitsOptions(comp)
-  const isProp = propsOptions ? (key: string) => hasOwn(propsOptions, key) : NO
+  const isProp = propsOptions
+    ? (key: string) => hasOwn(propsOptions, camelize(key))
+    : NO
   const isAttr = propsOptions
     ? (key: string) =>
         key !== '$' && !isProp(key) && !isEmitListener(emitsOptions, key)
     : YES
 
   const getProp = (instance: VaporComponentInstance, key: string) => {
-    if (key === '$' || !isProp(key)) {
-      return
-    }
+    if (!isProp(key)) return
     const rawProps = instance.rawProps
     const dynamicSources = rawProps.$
     if (dynamicSources) {
@@ -88,6 +88,7 @@ export function getPropsProxyHandlers(
       undefined,
       instance,
       resolveDefault,
+      true,
     )
   }
 
@@ -128,7 +129,7 @@ export function getPropsProxyHandlers(
       }
     }
     if (hasOwn(target, key)) {
-      return target[key]
+      return target[key]()
     }
   }
 
@@ -220,9 +221,9 @@ export function hasFallthroughAttrs(
       return true
     } else {
       // check if rawProps contains any keys not declared
-      const propsOptions = normalizePropsOptions(comp)[0]
+      const propsOptions = normalizePropsOptions(comp)[0]!
       for (const key in rawProps) {
-        if (!hasOwn(propsOptions!, key)) {
+        if (!hasOwn(propsOptions, camelize(key))) {
           return true
         }
       }