diff --git a/src/utils.ts b/src/utils.ts index f27368f40..23c10ea61 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -74,6 +74,8 @@ export const mergeDeep = ( if (Array.isArray(targetValue) && Array.isArray(sourceValue)) { target[key] = sourceValue + } else if (sourceValue instanceof Date) { + target[key] = sourceValue } else if (isObject(targetValue) && isObject(sourceValue)) { target[key] = mergeDeep(Object.assign({}, targetValue), sourceValue) } else { diff --git a/tests/setData.spec.ts b/tests/setData.spec.ts index 9d291eaf9..30cfabd55 100644 --- a/tests/setData.spec.ts +++ b/tests/setData.spec.ts @@ -187,4 +187,31 @@ describe('setData', () => { await wrapper.setData({ state: { items: ['2', '3'] } }) expect(wrapper.html()).toMatchInlineSnapshot(`"