From: daiwei Date: Wed, 23 Oct 2024 06:15:21 +0000 (+0800) Subject: fix(runtime-core): handle validate prop check edge case X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4ff11301ed4009d60e035e27d6a54332396fb099;p=thirdparty%2Fvuejs%2Fcore.git fix(runtime-core): handle validate prop check edge case --- diff --git a/packages/runtime-core/src/componentProps.ts b/packages/runtime-core/src/componentProps.ts index 8baa780866..5dd6939874 100644 --- a/packages/runtime-core/src/componentProps.ts +++ b/packages/runtime-core/src/componentProps.ts @@ -21,7 +21,9 @@ import { isOn, isReservedProp, isString, + isSymbol, makeMap, + stringifySymbol, toRawType, } from '@vue/shared' import { warn } from './warning' @@ -795,6 +797,8 @@ function styleValue(value: unknown, type: string): string { return `"${value}"` } else if (type === 'Number') { return `${Number(value)}` + } else if (isSymbol(value)) { + return stringifySymbol(value) } else { return `${value}` } diff --git a/packages/shared/src/toDisplayString.ts b/packages/shared/src/toDisplayString.ts index b23cf766a5..ff5e088e63 100644 --- a/packages/shared/src/toDisplayString.ts +++ b/packages/shared/src/toDisplayString.ts @@ -61,7 +61,7 @@ const replacer = (_key: string, val: unknown): any => { return val } -const stringifySymbol = (v: unknown, i: number | string = ''): any => +export const stringifySymbol = (v: unknown, i: number | string = ''): any => // Symbol.description in es2019+ so we need to cast here to pass // the lib: es2016 check isSymbol(v) ? `Symbol(${(v as any).description ?? i})` : v