2
0
Эх сурвалжийг харах

fix(devtools): allow devtools to identify parent components of hydrated elements.

Thorsten Luenborg 3 жил өмнө
parent
commit
934f26f7d8

+ 10 - 0
packages/runtime-core/src/hydration.ts

@@ -354,6 +354,16 @@ export function createHydrationFunctions(
           )
         }
       }
+      if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
+        Object.defineProperty(el, '__vnode', {
+          value: vnode,
+          enumerable: false
+        })
+        Object.defineProperty(el, '__vueParentComponent', {
+          value: parentComponent,
+          enumerable: false
+        })
+      }
       // vnode / directive hooks
       let vnodeHooks: VNodeHook | null | undefined
       if ((vnodeHooks = props && props.onVnodeBeforeMount)) {