From 3c6f38acb8f4f2ffc3bf4246ec0ce8f4686a0050 Mon Sep 17 00:00:00 2001
From: zhangchen <1652267879@qq.com>
Date: 星期一, 28 七月 2025 12:02:35 +0800
Subject: [PATCH] Merge branch 'ID2690-缓存修改' into test
---
src/utils/utils.ts | 22 +++++++++++++++++++++-
1 files changed, 21 insertions(+), 1 deletions(-)
diff --git a/src/utils/utils.ts b/src/utils/utils.ts
index 4081f1e..deeee91 100644
--- a/src/utils/utils.ts
+++ b/src/utils/utils.ts
@@ -28,4 +28,24 @@
}
return value;
-}
\ No newline at end of file
+}
+/**
+ * 深拷贝
+ * @param obj
+ * @returns
+ */
+export function deepClone<T>(obj: T): T {
+ if (obj === null || typeof obj !== "object") return obj;
+
+ if (Array.isArray(obj)) {
+ return obj.map(item => deepClone(item)) as unknown as T;
+ }
+
+ const result: any = {};
+ for (const key in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
+ result[key] = deepClone(obj[key]);
+ }
+ }
+ return result;
+}
--
Gitblit v1.8.0