From a1c58de5633148ec932e1557cf433dd869299072 Mon Sep 17 00:00:00 2001 From: ysy945 <79794654+ysy945@users.noreply.github.com> Date: Thu, 27 Oct 2022 15:57:47 +0800 Subject: [PATCH 1/3] update --- packages/runtime-dom/src/apiCustomElement.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/runtime-dom/src/apiCustomElement.ts b/packages/runtime-dom/src/apiCustomElement.ts index 5ff45d652f2..8b823a72697 100644 --- a/packages/runtime-dom/src/apiCustomElement.ts +++ b/packages/runtime-dom/src/apiCustomElement.ts @@ -198,6 +198,13 @@ export class VueElement extends BaseClass { */ private _resolveDef() { if (this._resolved) { + //#6934 if you use Both of KeepAlive and CustemElement, + //CustemElement will not recreate,so the property of + //"_resolved" would be "true",it means that should update it + if (this._resolved) { + this._applyStyles(this._def.styles) + this._update() + } return } this._resolved = true From afb75ea3e24be1d326b8e8c224f2289f7b3e7158 Mon Sep 17 00:00:00 2001 From: ysy945 <79794654+ysy945@users.noreply.github.com> Date: Thu, 27 Oct 2022 16:09:45 +0800 Subject: [PATCH 2/3] update --- packages/runtime-dom/src/apiCustomElement.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/runtime-dom/src/apiCustomElement.ts b/packages/runtime-dom/src/apiCustomElement.ts index 8b823a72697..7712126b53a 100644 --- a/packages/runtime-dom/src/apiCustomElement.ts +++ b/packages/runtime-dom/src/apiCustomElement.ts @@ -201,10 +201,8 @@ export class VueElement extends BaseClass { //#6934 if you use Both of KeepAlive and CustemElement, //CustemElement will not recreate,so the property of //"_resolved" would be "true",it means that should update it - if (this._resolved) { - this._applyStyles(this._def.styles) - this._update() - } + this._applyStyles(this._def.styles) + this._update() return } this._resolved = true From 31b3afd5b39dd77ba9965684f8951704b9170d34 Mon Sep 17 00:00:00 2001 From: Evan You Date: Fri, 11 Nov 2022 04:00:55 -0500 Subject: [PATCH 3/3] Update apiCustomElement.ts --- packages/runtime-dom/src/apiCustomElement.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/packages/runtime-dom/src/apiCustomElement.ts b/packages/runtime-dom/src/apiCustomElement.ts index 7712126b53a..9dd35bf7638 100644 --- a/packages/runtime-dom/src/apiCustomElement.ts +++ b/packages/runtime-dom/src/apiCustomElement.ts @@ -179,7 +179,11 @@ export class VueElement extends BaseClass { connectedCallback() { this._connected = true if (!this._instance) { - this._resolveDef() + if (this._resolved) { + this._update() + } else { + this._resolveDef() + } } } @@ -197,14 +201,6 @@ export class VueElement extends BaseClass { * resolve inner component definition (handle possible async component) */ private _resolveDef() { - if (this._resolved) { - //#6934 if you use Both of KeepAlive and CustemElement, - //CustemElement will not recreate,so the property of - //"_resolved" would be "true",it means that should update it - this._applyStyles(this._def.styles) - this._update() - return - } this._resolved = true // set initial attrs