From 2a81e39fa1c8afa1054e14ae258453345d3b87c1 Mon Sep 17 00:00:00 2001 From: enpitsulin Date: Wed, 30 Nov 2022 11:35:50 +0800 Subject: [PATCH] fix: toString util should unref the `Ref` fix #12884 --- src/shared/util.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/shared/util.ts b/src/shared/util.ts index 6eb54fdb4ef..b6d4f114770 100644 --- a/src/shared/util.ts +++ b/src/shared/util.ts @@ -1,3 +1,5 @@ +import { isRef, unref } from 'v3' + export const emptyObject: Record = Object.freeze({}) export const isArray = Array.isArray @@ -90,7 +92,7 @@ export function toString(val: any): string { return val == null ? '' : Array.isArray(val) || (isPlainObject(val) && val.toString === _toString) - ? JSON.stringify(val, null, 2) + ? JSON.stringify(isRef(val) ? unref(val) : val, null, 2) : String(val) }