Skip to content

Commit 2a81e39

Browse files
committed
fix: toString util should unref the Ref<T>
fix vuejs#12884
1 parent 9dd006b commit 2a81e39

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: src/shared/util.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { isRef, unref } from 'v3'
2+
13
export const emptyObject: Record<string, any> = Object.freeze({})
24

35
export const isArray = Array.isArray
@@ -90,7 +92,7 @@ export function toString(val: any): string {
9092
return val == null
9193
? ''
9294
: Array.isArray(val) || (isPlainObject(val) && val.toString === _toString)
93-
? JSON.stringify(val, null, 2)
95+
? JSON.stringify(isRef(val) ? unref(val) : val, null, 2)
9496
: String(val)
9597
}
9698

0 commit comments

Comments
 (0)