【发布时间】:2021-08-08 23:04:32
【问题描述】:
我正在使用 lit-element (Typescript) 开发 Web 组件。我有一个在 HTML 上表示的按钮,如下所示:
<wc-btn class="class1" attribute1></wc-btn>
attribute1 定义为反射:
@property({ type: Boolean, reflect: true })
public attribute1: Boolean = false;
问题是我是否可以在我的样式中将类与属性混合在一起,如下所示:
:host([attribute1] .class1) {}
or
:host([attribute1]) .class1 {}
或其他。我已经看到了这个问题,但对我不起作用:
litelement - how to compute style based on property or attribute values
提前致谢
【问题讨论】:
标签: css css-selectors attributes styles lit-element