From ab294ff05c4c4dab29913f301b0aea2ae41e0c43 Mon Sep 17 00:00:00 2001 From: JM <743192023@qq.com> Date: Sun, 5 Jan 2020 20:11:08 +0800 Subject: [PATCH] Bug Fixes for deepMerge --- src/util/index.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/util/index.js b/src/util/index.js index e8f512d..3a52692 100644 --- a/src/util/index.js +++ b/src/util/index.js @@ -6,8 +6,19 @@ export function filterNonNumber (array) { export function deepMerge (target, merged) { for (var key in merged) { - target[key] = target[key] && typeof target[key] === 'object' ? - deepMerge(target[key], merged[key]) : target[key] = merged[key] + if (target[key] && typeof target[key] === 'object') { + deepMerge(target[key], merged[key]) + + continue + } + + if (typeof merged[key] === 'object') { + target[key] = deepClone(merged[key], true) + + continue + } + + target[key] = merged[key] } return target