From e2601243d7ded84895942f542f5d3010215e06df Mon Sep 17 00:00:00 2001 From: ysy945 <79794654+ysy945@users.noreply.github.com> Date: Fri, 11 Nov 2022 17:06:21 +0800 Subject: [PATCH] fix(custom-elements): custom element should re-instantiate when inserted again (#6966) fix #6934 --- packages/runtime-dom/src/apiCustomElement.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/runtime-dom/src/apiCustomElement.ts b/packages/runtime-dom/src/apiCustomElement.ts index 4de753e38be..7710d57216a 100644 --- a/packages/runtime-dom/src/apiCustomElement.ts +++ b/packages/runtime-dom/src/apiCustomElement.ts @@ -196,7 +196,11 @@ export class VueElement extends BaseClass { connectedCallback() { this._connected = true if (!this._instance) { - this._resolveDef() + if (this._resolved) { + this._update() + } else { + this._resolveDef() + } } } @@ -214,9 +218,6 @@ export class VueElement extends BaseClass { * resolve inner component definition (handle possible async component) */ private _resolveDef() { - if (this._resolved) { - return - } this._resolved = true // set initial attrs