Can';当聚合物数据绑定到自定义html标记时,它不能在标准标记上工作
我使用的是polymer 1.3.1,但无法在名为的polymer元素中实现以下功能:Can';当聚合物数据绑定到自定义html标记时,它不能在标准标记上工作,html,css,data-binding,polymer,Html,Css,Data Binding,Polymer,我使用的是polymer 1.3.1,但无法在名为的polymer元素中实现以下功能:poly main。的文本应为红色,但不是 <div testcolor="[[colorLocalRed]]"> -->ERROR This must be RED because testcolor="[[colorLocalRed]]" (expected "myred" and styles.css translates this to color="red") </div&g
poly main
。
的文本应为红色,但不是
<div testcolor="[[colorLocalRed]]">
-->ERROR This must be RED because testcolor="[[colorLocalRed]]"
(expected "myred" and styles.css translates this to color="red")
</div>
以及以下内部样式.css:'
[testcolor="myred"] {
color: red;
}
注:以下各项应按要求进行:
一些红色文本
不使用自定义标记
testcolor
,但直接使用样式或颜色不是一个选项,因为此示例仅显示数据绑定到非标准html标记的问题,我想这就是您想要的:
<div testcolor$="[[colorLocalRed]]">
将$
添加到属性名会绑定到属性,而不是CSS中无法寻址的属性
有关更多详细信息,请参见谢谢,它可以工作,35秒后就可以了。你能给我指一下有关使用美元的更多信息吗。(
testcolor$=“myred”
不起作用,但仍必须表示为testcolor=“myred”
我添加了答案的链接。
<div testcolor$="[[colorLocalRed]]">