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
<!-- page.webc --><my-component>
My content is here
</my-component>
I want to use JavaScript to generate the output of my-component. How do I access the default slot content (or any named slot for that matter)?
<!-- my-component.webc --><scriptwebc:type="js" webc:root>// How do I use the default slot here?// This definitely won't work, but illustrates what I'm trying to do// The output when used like above should be// <div>My content is here</div>`<div>${slot.default}</div>`;</script>
I could keep everything in attributes and props as a workaround, but for various reasons it would be more ergonomic in my case to use a slot (you get syntax highlighting there, for example).
The text was updated successfully, but these errors were encountered:
Wow, I accidentally figured out that slots.text contains .default for the default slot, and I assume it will also have keys for named slots. So the above example works if I do this:
Suppose I'm using a WebC component like this:
I want to use JavaScript to generate the output of
my-component
. How do I access the default slot content (or any named slot for that matter)?I could keep everything in attributes and props as a workaround, but for various reasons it would be more ergonomic in my case to use a slot (you get syntax highlighting there, for example).
The text was updated successfully, but these errors were encountered: