XboxYan / xy-ui

🎨面向未来的原生 web components UI组件库
https://xy-ui.codelabo.cn/
MIT License
1.2k stars 161 forks source link

xy-input label attribute / property can't be set dynamically? #43

Open bahrus opened 5 years ago

bahrus commented 5 years ago

Great library, I like your visual effects.

I may be missing something, but if I open chrome tools to this page: https://xy-ui.codelabo.cn/docs/#/xy-input, and try to modify the label property / attribute, nothing happens. Is this by design? It would be nice to have the ability to change the label.

XboxYan commented 5 years ago

yes, some attributes are not dynamically, because it doesn't always need to change you can watch it in attributeChangedCallback

attributeChangedCallback (name, oldValue, newValue) {
    //
}
bahrus commented 5 years ago

I am adding your component into a document dynamically, including setting the attribute dynamically. I think because you are constructing the shadowRoot.innerHTML in the constructor, rather than in connectedCallback, the attribute is not yet established, and isn't getting applied.