devtools icon indicating copy to clipboard operation
devtools copied to clipboard

Feature: detect shareable appContext components

Open theniceangel opened this issue 1 year ago • 6 comments

在组件库的设计当中,往往可能存在多个 App,但是有一些 App 不是通过 createApp 方法构造而来的,比如 ElementPlus 的 MessageBox 组件,它是通过 render 方法,直接渲染一个与主应用程序分离的 DOM 树,比如: image

对于 App2 来说,我借用了 App1 的 appContext,就是为了共享 App1 上面的全局组件,VueI18N,全局方法之类的。

但是 App2 永远不会被插件给捕捉到

image

当然,看了 Vue3 的源码,发现只有调用 mount 的时候,App 才会被记录

image

对于我这种场景,如果想要使用 VueDevTools 调试 App2 组件,应该怎么办?下面是可调试的 Demo:

shareable-context.zip

theniceangel avatar Jun 15 '24 00:06 theniceangel