-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to Pass Object Props from Custom Component to Vue Component #202
Comments
I will try to check it soon. From a quick look I can see that using JSON.stringify() when passing object using JS is wrong approach - it should be just passed normally. |
@karol-f I am using JSON.stringify() to pass it as a String to the Custom Element and then converting it back to a Object for the Vue Component using JSON.parse(). Update: I removed JSON.stringify() from index.html and moved it to main.js |
Hi, You have example how to use object prop on e.g. https://karol-f.github.io/vue-custom-element/#/demos/binding
or
Does it work for You? |
Hi @karol-f I am able to pass the object to Custom Element from HTML. Below is another way to pass it as an Object, as mentioned by you in other posts.
The issue is passing the object back from the Custom Element to the App Vue Component using Props
|
Can You just prepare CodeSandbox with that? It will be easier. |
I have uploaded the file in my GitHub Repo test-custom-elem.js is bundled so I have included the source map as well so you should be able to debug and see the code. Let me know if this helps. Update: Please refer to main.js & App.Vue in the sandbox link. I am using vue.config.js to compile which seems to be failing in the code sandbox but you should be able to see the basic code in the files. I have also included index.html in the dist folder so you should able to see how I am invoking the vue-custom-element. |
Hi, sorry for the late reply - I've checked CodeSandbox and after few tweaks I can see that it works as intended - https://codesandbox.io/s/vue-template-4xy07?file=/src/components/Test.vue Can You please take a look? |
@Mangesh-P did You try setting it in JS? #202 (comment) |
It seems I can't pass Object data from Custom Element to Vue Component.
I am defining the Custom Element in Vue and then using objectProp in JS to create an Object and passing it.
In the App.vue the object appears to be undefined.
Here is what I have in main.js file of Vue Project
In App.vue file
In the Index.html file
The text was updated successfully, but these errors were encountered: