0

我使用 Angular 9.1.6 为公共回购做出了贡献,语法如下

<div [style.--color-success]="'green'" >This is a div</div>

我得到了一个这样的编译html

<div style="--color-success:green" >This is a div</div>

这已合并,现在我在当前项目中使用 angular 9.1.0 的该组件,并且我编译的 html 忽略了自定义属性,尽管它保留了 style 属性

<div style>This is a div</div>

然后我尝试了这种语法

<div [style.--color-success]="'green'" style="--color-mid:orange">This is a div</div>

使用一种语法而不是另一种语法给出编译后的 html

<div style="--color-mid:orange" >This is a div</div>

是否有任何角度配置会阻止使用这种语法?

4

1 回答 1

1

见这里,似乎是固定的 Angular 9 + Ivy https://github.com/angular/angular/issues/9343#issuecomment-550572936

于 2020-05-13T16:24:36.257 回答