Skip to content

Commit 684a581

Browse files
committed
fix: keep use JSON.parse format input data.(#1153)
1 parent 7b174f8 commit 684a581

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

packages/core/src/util/compatible.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { cloneDeep } from 'lodash-es';
2-
3-
// 需要进行兼容操作,提供的方法
4-
1+
// import { cloneDeep } from 'lodash-es';
52
// vue中data会进行Observe, 深拷贝的原始数据对象。
63
export const formatData = (data) => {
74
try {
8-
return cloneDeep(data);
5+
// WARNING: cloneDeep虽然也会将Observe对象转换为plain对象,但是不会像JSON.parse那样,会将undefined去掉。
6+
// 会导致后面的pick因为存在pick覆盖默认值的情况。
7+
return JSON.parse(JSON.stringify(data));
98
} catch {
109
return data;
1110
}

0 commit comments

Comments
 (0)