stencil-component

Stencil object properties are not set, when they provided through the HTML string

Deadly 提交于 2021-02-08 06:52:37
问题 According to documentation, Stencil component's property myProperty @Prop({attribute: "my-prop"}) public myProperty?: object = {}; should be set by using this HTML code: <my-component my-prop="{hello: 'world'}" ></my-component> But, instead, it's set to default value (empty object). Boolean and string values work fine. Is it a bug, or I've overlooked something? 回答1: Stencil does not automatically parse object properties. You have two options: Set the property using JavaScript Set it as a HTML

Web components: How to work with children?

谁都会走 提交于 2020-12-29 05:41:31
问题 I'm currently experimenting with StencilJS to create some web components. Now I know that there is <slot /> and named slots and all that stuff. Coming from React, I guess slot is similar to children in React. You can do a lot of stuff using children in React. Things I often did: Check if any children are provided Iterate over children to do something to each child (e.g. wrap it in a div with a class etc.) How would you do that using slot/web components/stencilJS? I can get the Host Element of

Web components: How to work with children?

自古美人都是妖i 提交于 2020-12-29 05:40:28
问题 I'm currently experimenting with StencilJS to create some web components. Now I know that there is <slot /> and named slots and all that stuff. Coming from React, I guess slot is similar to children in React. You can do a lot of stuff using children in React. Things I often did: Check if any children are provided Iterate over children to do something to each child (e.g. wrap it in a div with a class etc.) How would you do that using slot/web components/stencilJS? I can get the Host Element of

Web components: How to work with children?

你离开我真会死。 提交于 2020-12-29 05:40:13
问题 I'm currently experimenting with StencilJS to create some web components. Now I know that there is <slot /> and named slots and all that stuff. Coming from React, I guess slot is similar to children in React. You can do a lot of stuff using children in React. Things I often did: Check if any children are provided Iterate over children to do something to each child (e.g. wrap it in a div with a class etc.) How would you do that using slot/web components/stencilJS? I can get the Host Element of

Ionic Stencil: Extending default components

梦想与她 提交于 2019-12-08 05:43:33
问题 I need to make certain changes in the behavior of some of the ionic components. It was easy enough with Ionic 3 and angular components, but now that we're migrating to Ionic 4, I'm finding it more challenging to alter the default web components in @ionic/core . I have created a new stencil components project and added the npm package for @ionic/core . I tired extending the datetime component and found that the web components cannot have super classes. So I copied over the entire folder for