From 8d42fd0eaeaf86074029603e5726bab6a4641e51 Mon Sep 17 00:00:00 2001
From: chenyc <501753378@qq.com>
Date: 星期五, 25 七月 2025 15:07:32 +0800
Subject: [PATCH] Merge branch 'test' of http://dh.leon056.com:7499/r/data2/Single_application 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