Closed devcli closed 4 years ago
It's the same Vue as when You define Vue.use(VueCustomElement)
- so You can easily access it there.
About vue instance - every custom element instance on the page has its own, separate, vue instance (created when it's inserted to DOM) and you have access to it like you mentioned above.
Regards
Thank you!!
How to initialize
vue-custom-element
via code without a custom element on a page?Basically, I need access to the actual vue instance when the Vue app is part of the vue-custom-element.
I can see in the docs that there is a way to get access to vue instance like this:
document.querySelector('widget-vue').getVueInstance()
This only works when I have
<widget-vue>
element on a page.I am creating a third party widget where
<widget-vue>
element is optional. But I want to access Vue instance and run methods of the Vue app even when an element is not added to the page.Please let me know if there is a proper way to do it.