karol-f / vue-custom-element

Vue Custom Element - Web Components' Custom Elements for Vue.js
https://karol-f.github.io/vue-custom-element/
MIT License
1.97k stars 187 forks source link

Pass array to Web Component #124

Closed dimfried closed 6 years ago

dimfried commented 6 years ago

Hi,

I am using the created Web Components in a static HTML file. It works all good until I come to the point where I'd like to pass an array as props. It seems like the array is converted into a string. Is this a known issue? And is there maybe a workaround?

Thanks for your help! Dimitri

karol-f commented 6 years ago

Yes, if you pass anything via props it's passed by browser to custom element as sting. Just pass value using JS: document.querySelector('demo-basic').arrayProp = [1,2,3].

Feel free to ask more questions.

dimfried commented 6 years ago

Alright, good to know :). Thanks for your help!

kyleoliveiro commented 6 years ago

@karol-f Is it possible to pass array prop through HTML though? In some cases it may be inconvenient for the CE consumer to use JS to set the props. Polymer is able to do this.