@mybricks/to-code-taro 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -38,10 +38,6 @@ function deepProxy(target, onSet) {
|
|
|
38
38
|
if (prop === "toJSON")
|
|
39
39
|
return () => obj;
|
|
40
40
|
let value = obj[prop];
|
|
41
|
-
const mybricksMethods = ["get", "set", "changed", "reset", "registerChange", "call", "apply", "bind", "push", "pop"];
|
|
42
|
-
if (value === void 0 && typeof prop === "string" && !mybricksMethods.includes(prop)) {
|
|
43
|
-
value = obj[prop] = {};
|
|
44
|
-
}
|
|
45
41
|
if (typeof value === "object" && value !== null && !value.__isProxy) {
|
|
46
42
|
obj[prop] = deepProxy(value, onSet);
|
|
47
43
|
}
|
|
@@ -19,12 +19,8 @@ export function deepProxy(target, onSet) {
|
|
|
19
19
|
};
|
|
20
20
|
var value = obj[prop];
|
|
21
21
|
|
|
22
|
-
//
|
|
23
|
-
//
|
|
24
|
-
var mybricksMethods = ['get', 'set', 'changed', 'reset', 'registerChange', 'call', 'apply', 'bind', 'push', 'pop'];
|
|
25
|
-
if (value === undefined && typeof prop === 'string' && !mybricksMethods.includes(prop)) {
|
|
26
|
-
value = obj[prop] = {};
|
|
27
|
-
}
|
|
22
|
+
// 只代理已存在的对象属性,不自动创建空对象
|
|
23
|
+
// 避免访问不存在的属性(如 disabled)时污染原始数据
|
|
28
24
|
if (_typeof(value) === 'object' && value !== null && !value.__isProxy) {
|
|
29
25
|
obj[prop] = deepProxy(value, onSet);
|
|
30
26
|
}
|