]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(runtime-core): handle validate prop check edge case
authordaiwei <daiwei521@126.com>
Wed, 23 Oct 2024 06:15:21 +0000 (14:15 +0800)
committerdaiwei <daiwei521@126.com>
Wed, 23 Oct 2024 06:15:21 +0000 (14:15 +0800)
packages/runtime-core/src/componentProps.ts
packages/shared/src/toDisplayString.ts

index 8baa780866529bfded617f22c0b0741ce9265595..5dd6939874697a3d6a454f80b19fb13274fc7650 100644 (file)
@@ -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}`
   }
index b23cf766a5c802e88c2324578b411e9e05074c0c..ff5e088e636cdeb29606074186dcdd4acc8e557b 100644 (file)
@@ -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