我的 polymer 元素:
<ele-label id="newLabel" color="#000000" bgColor="#f1f1f1" eleHeight="30" eleWidth="50" text="Name:" eleDisplay="inline-block" elefloat="left"></ele-label>
但是当我克隆这个元素时,内部 html 将被删除。
谁能帮帮我?
<polymer-element name="ele-label" attributes="text color eleid eleWidth eleHeight fontSize bgColor paddingTop paddingBottom paddingLeft paddingRight eleDisplay elefloat" > <template> <div><label style="font-size:{{fontSize}}pt; color:{{color}} ;">{{text}}</label></div> </template></polymer-element>
最佳答案
终于找到解决方案了
polylabel1 : polymer 元素侧模板中我的 div 的 id。
Polymer('ele-label', {
ready: function()
{
this.innerHTML=this.$.polylabel1.outerHTML;
}
attributeChanged: function()
{
this.innerHTML=this.$.polylabel1.outerHTML;
}
}
关于javascript - polymer 元件的克隆去除 polymer 元件的模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22680770/