From 3d2bcadf337531f2c8c7ed90f5d2730a75411315 Mon Sep 17 00:00:00 2001 From: 1921622004 <1921622004qwer@gmail.com> Date: Mon, 5 Nov 2018 21:45:20 +0800 Subject: [PATCH] fix bug --- packages/omi/src/we-element.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/packages/omi/src/we-element.js b/packages/omi/src/we-element.js index 905603657..fb8d89cdb 100644 --- a/packages/omi/src/we-element.js +++ b/packages/omi/src/we-element.js @@ -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()