From c7a549da66df42d4ec5c78ddf2cc138772616941 Mon Sep 17 00:00:00 2001
From: chenyabin <Chenab123!>
Date: 星期一, 19 四月 2021 14:05:46 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/develop' into develop
---
src/utils/utils.js | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/src/utils/utils.js b/src/utils/utils.js
index 8ace9bb..4fbfed4 100644
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -22,3 +22,38 @@
// eslint-disable-next-line no-unreachable
return url + '\n' + arg + '\n' + argValue
}
+
+/**
+ * 澶嶅埗瀵硅薄
+ * @param obj
+ * @returns {{}}
+ */
+export function clone (obj) {
+ var o
+ // 濡傛灉 浠栨槸瀵硅薄object鐨勮瘽 , 鍥犱负null,object,array 涔熸槸'object';
+ if (typeof obj === 'object') {
+ // 濡傛灉 浠栨槸绌虹殑璇�
+ if (obj === null) {
+ o = null
+ } else {
+ // 濡傛灉 浠栨槸鏁扮粍arr鐨勮瘽
+ if (obj instanceof Array) {
+ o = []
+ for (var i = 0, len = obj.length; i < len; i++) {
+ o.push(clone(obj[i]))
+ }
+ } else {
+ // 濡傛灉 浠栨槸瀵硅薄object鐨勮瘽
+ o = {}
+ for (var j in obj) {
+ o[j] = clone(obj[j])
+ }
+ }
+ }
+ } else {
+ o = obj
+ }
+ return o
+}
+
+export default clone
--
Gitblit v1.8.0