Browse Source

fix update Marker.

windsome.feng 7 years ago
parent
commit
24f1ba2be2
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/api.js

+ 6 - 6
src/api.js

@@ -271,15 +271,15 @@ export const updateMarker = (
         // 找到改变的旧属性,用新属性取代
         // 找到改变的旧属性,用新属性取代
         let newValue = newOptions && newOptions[key];
         let newValue = newOptions && newOptions[key];
         if (!isEqual(newValue, value)) {
         if (!isEqual(newValue, value)) {
-          //if (newValue != value) {
-          props[key] = newValue;
+          if (!(isNil(newValue) && isNil(value)))
+            props[key] = newValue;
         }
         }
       });
       });
     newOptions &&
     newOptions &&
       forOwn(newOptions, (value, key) => {
       forOwn(newOptions, (value, key) => {
         // 找到新加的属性,添加进去
         // 找到新加的属性,添加进去
         let oldValue = oldOptions && oldOptions[key];
         let oldValue = oldOptions && oldOptions[key];
-        if (oldValue == null) {
+        if (isNil(oldValue) && !isNil(value)) {
           props[key] = value;
           props[key] = value;
         }
         }
       });
       });
@@ -292,15 +292,15 @@ export const updateMarker = (
         // 找到改变的旧属性,用新属性取代
         // 找到改变的旧属性,用新属性取代
         let newValue = newEvents && newEvents[key];
         let newValue = newEvents && newEvents[key];
         if (!isEqual(newValue, value)) {
         if (!isEqual(newValue, value)) {
-          //if (newValue != value) {
-          events[key] = newValue;
+          if (!(isNil(newValue) && isNil(value)))
+            events[key] = newValue;
         }
         }
       });
       });
     newEvents &&
     newEvents &&
       forOwn(newEvents, (value, key) => {
       forOwn(newEvents, (value, key) => {
         // 找到新加的属性,添加进去
         // 找到新加的属性,添加进去
         let oldValue = oldEvents && oldEvents[key];
         let oldValue = oldEvents && oldEvents[key];
-        if (oldValue == null) {
+        if (isNil(oldValue) && !isNil(value)) {
           events[key] = value;
           events[key] = value;
         }
         }
       });
       });