From 65033cec9db46573b804c4372ad2be29c5d338ce Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 4 Oct 2018 16:35:07 -0400 Subject: [PATCH] feat: expose __vue__ in dev mode --- packages/core/src/createRenderer.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/core/src/createRenderer.ts b/packages/core/src/createRenderer.ts index aee6bd1c..c42a217a 100644 --- a/packages/core/src/createRenderer.ts +++ b/packages/core/src/createRenderer.ts @@ -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