globalProperties and defineCustomElement #9588
Replies: 2 comments
-
I was able to do what I wanted by extending the _update() {
const vnode = this._createVNode();
vnode.appContext = this.createAppContext();
vnode.appContext.config.globalProperties.GlobalAttr = GlobalAttr;
render(vnode, this.shadowRoot!);
} |
Beta Was this translation helpful? Give feedback.
0 replies
-
This is my solution to use primevue in web-components.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello
I need to use a Vue.js library as webcomponent, I have used the
defineCustomElement
method successfully so far, however one of the component (that I do not control), is using an variable that is coming from theapp.config.globalProperties
(injected by a plugin).core/packages/runtime-dom/src/apiCustomElement.ts
Line 144 in fc79029
I tried to inject the same variable inside component created by
defineCustomElement
but no luck so far.From what I have seen, if I was able to inject this variable into an
appContext.config.globalProperties
it would work, however I could not find an entry point for that.My idea was to set
vnode.appContext
so it would be picked up here:core/packages/runtime-core/src/component.ts
Lines 491 to 494 in fc79029
But I was not able to, because the VNode in the
defineCustomElement
in defined ascore/packages/runtime-dom/src/apiCustomElement.ts
Lines 362 to 364 in fc79029
which does not expose any other configuration (except props)
Is there a way to achieve what I want to do ? I have tried to extends the
defineCustomElement
with my own elemnt in order to implement some callback but I still can't make it work:Beta Was this translation helpful? Give feedback.
All reactions