【发布时间】:2020-04-15 19:25:48
【问题描述】:
在 webcomponents 中,我们有两种类型的插槽(命名插槽和默认插槽)。我们可以使用语法slot[name]::slotted(*) 轻松设置命名槽的样式。但是有什么方法可以设置默认插槽的样式,因为它们没有任何关联的名称?
代码是这样的,我正在使用 Angular Elements。
<div class="topbar-item">
<slot class="icon" name="icon"></slot>
<span class="text">
<slot></slot> <-- This is the slot i want to add styles, only if the slot has some data assigned. (need to add margin-left)
</span>
</div>
【问题讨论】:
标签: angular web-component angular-elements native-web-component