@ohuoy/easymap 1.1.3 → 1.1.4
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.
- package/package.json +1 -1
- package/src/utils/mapWatch.js +4 -1
package/package.json
CHANGED
package/src/utils/mapWatch.js
CHANGED
|
@@ -40,7 +40,7 @@ function update(target, key) {
|
|
|
40
40
|
deps.forEach((dep) => dep());
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
export function observe(obj){
|
|
43
|
+
export function observe(obj,eventFun){
|
|
44
44
|
if (typeof obj !== "object") {
|
|
45
45
|
return obj;
|
|
46
46
|
}
|
|
@@ -58,6 +58,9 @@ export function observe(obj){
|
|
|
58
58
|
const res = Reflect.set(target, key, val, receiver);
|
|
59
59
|
// 侦听到数据变化,执行相应回调
|
|
60
60
|
update(target, key);
|
|
61
|
+
if(eventFun){
|
|
62
|
+
eventFun(target,key, val, receiver)
|
|
63
|
+
}
|
|
61
64
|
return res;
|
|
62
65
|
}
|
|
63
66
|
})
|