From 5e746c19ea88ef33cd20b48ac93fd8912872367b Mon Sep 17 00:00:00 2001 From: lejunyang Date: Thu, 25 Apr 2024 17:42:56 +0800 Subject: [PATCH] fix(components): sync the change from https://github.com/vuejs/core/pull/9012 --- packages/components/src/custom/apiCustomElement.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/src/custom/apiCustomElement.ts b/packages/components/src/custom/apiCustomElement.ts index 5323d91a..8c2fc2b1 100644 --- a/packages/components/src/custom/apiCustomElement.ts +++ b/packages/components/src/custom/apiCustomElement.ts @@ -366,7 +366,7 @@ export class VueElement extends BaseClass { protected _setAttr(key: string) { // ignore data- and aria- attrs if (key.startsWith('data-') || key.startsWith('aria-')) return; - let value: any = this.getAttribute(key); + let value: any = this.hasAttribute(key) ? this.getAttribute(key) : undefined; const camelKey = camelize(key); if (this._numberProps && this._numberProps[camelKey]) { value = toNumberIfValid(value);