Procházet zdrojové kódy

chore: fix reviews

daiwei před 3 měsíci
rodič
revize
24e3ce06a1
1 změnil soubory, kde provedl 5 přidání a 2 odebrání
  1. 5 2
      packages/runtime-core/src/component.ts

+ 5 - 2
packages/runtime-core/src/component.ts

@@ -1114,12 +1114,15 @@ const attrsProxyHandlers = __DEV__
 const createSlotsProxyHandlers = (
   instance: ComponentInternalInstance,
 ): ProxyHandler<InternalSlots> => ({
-  get(target, key: string) {
+  get(target, key: string | symbol) {
     if (__DEV__) {
       track(instance, TrackOpTypes.GET, '$slots')
     }
     // in-DOM templates use kebab-case slot names, only relevant in browser
-    return target[key] || (__BROWSER__ && target[hyphenate(key)])
+    return (
+      target[key as string] ||
+      (__BROWSER__ && typeof key === 'string' && target[hyphenate(key)])
+    )
   },
 })