const util = { deepCopy(obj) { // 深拷贝 if (obj == null) { return null; } if (typeof obj !== "object") return obj; let result; if (Array.isArray(obj)) { result = []; obj.forEach(item => { result.push( typeof item === "object" && !(item instanceof Date) ? util.deepCopy(item) : item ); }); } else { result = {}; Object.keys(obj).forEach(key => { result[key] = typeof obj[key] === "object" && !(obj[key] instanceof Date) ? util.deepCopy(obj[key]) : obj[key]; }); } return result; } }; export default util;