Browse Source

reduce log.
fix refer in div of Map.

windsome.feng 7 years ago
parent
commit
9efcaf1da5
7 changed files with 28 additions and 18 deletions
  1. 1 0
      .gitignore
  2. 2 1
      .npmignore
  3. 2 1
      lib/Map.js
  4. 9 6
      lib/api.js
  5. 1 1
      package.json
  6. 1 0
      src/lib/Map.js
  7. 12 9
      src/lib/api.js

+ 1 - 0
.gitignore

@@ -8,6 +8,7 @@
 
 # production
 /build
+/lib
 
 # misc
 .DS_Store

+ 2 - 1
.npmignore

@@ -1,2 +1,3 @@
 .babelrc
-CODE_OF_CONDUCT.md
+package-lock.json
+yarn.lock

+ 2 - 1
lib/Map.js

@@ -141,6 +141,7 @@ export var Map = function (_Component) {
 
       var _props3 = this.props,
           AMap = _props3.AMap,
+          refer = _props3.refer,
           options = _props3.options,
           events = _props3.events,
           match = _props3.match,
@@ -148,7 +149,7 @@ export var Map = function (_Component) {
           history = _props3.history,
           children = _props3.children,
           staticContext = _props3.staticContext,
-          rest = _objectWithoutProperties(_props3, ['AMap', 'options', 'events', 'match', 'location', 'history', 'children', 'staticContext']);
+          rest = _objectWithoutProperties(_props3, ['AMap', 'refer', 'options', 'events', 'match', 'location', 'history', 'children', 'staticContext']);
 
       return React.createElement(
         'div',

+ 9 - 6
lib/api.js

@@ -5,6 +5,7 @@ function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in ob
 import forOwn from 'lodash/forOwn';
 import isEqual from 'lodash/isEqual';
 import isNil from 'lodash/isNil';
+import isEmpty from 'lodash/isEmpty';
 //import loadjscssfile from './loadScript';
 import APILoader from './APILoader';
 
@@ -196,12 +197,14 @@ export var commonUpdate = function commonUpdate(entity, newOptions, newEvents, o
       entity.on(key, value);
     }
   });
-  console.log(__func__, 'update:', props, events
-  // newOptions,
-  // newEvents,
-  // oldOptions,
-  // oldEvents
-  );
+  if (!isEmpty(props) || !isEmpty(events)) {
+    console.log(__func__, 'update:', props, events
+    // newOptions,
+    // newEvents,
+    // oldOptions,
+    // oldEvents
+    );
+  }
   return true;
 };
 

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "react-amap-next",
-  "version": "1.1.3",
+  "version": "1.1.4",
   "description": "这是高德地图的react版本,相比react-amap更加简单,更加贴合react用户",
   "keywords": [
     "react",

+ 1 - 0
src/lib/Map.js

@@ -119,6 +119,7 @@ export class Map extends Component {
     debug(__com__, 'component render', this._entity);
     let {
       AMap,
+      refer,
       options,
       events,
       match,

+ 12 - 9
src/lib/api.js

@@ -1,6 +1,7 @@
 import forOwn from 'lodash/forOwn';
 import isEqual from 'lodash/isEqual';
 import isNil from 'lodash/isNil';
+import isEmpty from 'lodash/isEmpty';
 //import loadjscssfile from './loadScript';
 import APILoader from './APILoader'
 
@@ -205,15 +206,17 @@ export const commonUpdate = (
       entity.on(key, value);
     }
   });
-  console.log(
-    __func__, 'update:',
-    props,
-    events,
-    // newOptions,
-    // newEvents,
-    // oldOptions,
-    // oldEvents
-  );
+  if (!isEmpty(props) || !isEmpty(events)) {
+    console.log(
+      __func__, 'update:',
+      props,
+      events,
+      // newOptions,
+      // newEvents,
+      // oldOptions,
+      // oldEvents
+    );
+  }
   return true;
 };