]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
feat: expose __vue__ in dev mode
authorEvan You <yyx990803@gmail.com>
Thu, 4 Oct 2018 20:35:07 +0000 (16:35 -0400)
committerEvan You <yyx990803@gmail.com>
Thu, 4 Oct 2018 20:35:07 +0000 (16:35 -0400)
packages/core/src/createRenderer.ts

index aee6bd1c7f29d349196269fb81b4955393edf00f..c42a217a51e7a77cc3f5df738cba2f5464116b7b 100644 (file)
@@ -1200,6 +1200,10 @@ export function createRenderer(options: RendererOptions) {
           instance.$vnode = renderInstanceRoot(instance) as MountedVNode
           mount(instance.$vnode, container, instance, isSVG, endNode)
           parentVNode.el = instance.$vnode.el
+          if (__DEV__) {
+            // expose __vue__ for devtools
+            ;(parentVNode.el as any).__vue__ = instance
+          }
           instance._mounted = true
           mountComponentInstanceCallbacks(instance, parentVNode.ref)
         }
@@ -1242,6 +1246,11 @@ export function createRenderer(options: RendererOptions) {
     patch(prevVNode, nextVNode, container, instance, isSVG)
     const el = nextVNode.el as RenderNode
 
+    if (__DEV__) {
+      // expose __vue__ for devtools
+      ;(el as any).__vue__ = instance
+    }
+
     // recursively update parentVNode el for nested HOCs
     if ((nextVNode.flags & VNodeFlags.PORTAL) === 0) {
       let vnode = instance.$parentVNode