#webcompoents — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #webcompoents, aggregated by home.social.
-
#WebComponents な Custom Elements である以上、属性値では基本 String しか渡せないはずなので
> Riot.js passes all primitive data (strings, numbers, booleans) to Custom Elements as attributes
これは Custom Elements としてはちょっと解せないんだよな…
今手元で試しても props は全部 strings になっちゃうし。ただ、
> It passes complex data (Objects, Arrays) to Custom Elements as properties.
これについては、たとえば親コンポーネントの中で
```
this.root.shadow.querySelector('子コンポーネント要素').プロパティ名
```という風にすると、親から子の中のプロパティに Object とか Array を渡すことができた。