You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vue init method makes a Ajax call to "https://api.myjson.com/bins/orphn". and responds a HTML, JS injected to #dinamic-container div.
HTML, JS injected also includes a Vue instance.
creating conflicts "[vuex] already installed. Vue.use(Vuex) should be called only once."
What is expected?
load page, instantiate VUE.
when a page is injected and includes a VUE instance. load with no conflicts.
What is actually happening?
load page, instantiate VUE.
when page is injected and includes a VUE instance. a conflict is raised and show the "[vuex] already installed. Vue.use(Vuex) should be called only once." console error.
Remember.
My parent view is loading Vue instance.
and I'm injecting a Child view that also contains its own Vue instance.
The text was updated successfully, but these errors were encountered:
As the error message described, it's because you are installing Vuex into Vue two times - the first is in the script loaded at the same time as the page is loaded, the second is in late injected script after ajax request. Note that Vuex is automatically installed if Vue is in window.
FYI: you seems to load the library code in multiple times. It would cause unexpected behavior and should be avoided. I'm not sure why you load the script by explicitly calling ajax request but I would suggest you to load the libs only one time per page.
@ktsn thank you.
In this case, I don't have to much control. we developed a checkout that can be injected in any merchants page, using the example I show you.
We ask the merchant to call our endpoint and include the html, js to their page.
I have control over the Vue instance that is called through Ajax.
There is a way I can create a scope/namespace? so both Vue instances can live in the same page?? or how can I prevent my instance to instantiate again and use the one already created.
Version
2.0.0
Reproduction link
https://jsfiddle.net/15ww4vog/7/
Steps to reproduce
#dinamic-container
div.What is expected?
What is actually happening?
Remember.
My parent view is loading Vue instance.
and I'm injecting a Child view that also contains its own Vue instance.
The text was updated successfully, but these errors were encountered: