This commit is contained in:
1921622004 2018-11-05 21:45:20 +08:00
parent b420188131
commit 3d2bcadf33
1 changed files with 12 additions and 1 deletions

View File

@ -28,7 +28,18 @@ export default class WeElement extends HTMLElement {
}
this.install()
const shadowRoot = this.attachShadow({ mode: 'open' })
var shadowRoot
if (!this.shadowRoot) {
shadowRoot = this.attachShadow({
mode: 'open'
})
} else {
shadowRoot = this.shadowRoot
var fc
while (fc = shadowRoot.firstChild) {
shadowRoot.removeChild(fc)
}
}
this.css && shadowRoot.appendChild(cssToDom(this.css()))
this.beforeRender()