Browse Source

feat:修改打包

wumuwumu 5 years ago
parent
commit
7f9d1353ea
7 changed files with 131 additions and 101 deletions
  1. 22 22
      lib/Marker.js
  2. 98 57
      lib/api.js
  3. 1 1
      lib/loadScript.js
  4. 1 4
      lib/webservice.js
  5. 1 0
      package.json
  6. 6 15
      src/App.js
  7. 2 2
      src/lib/api.js

+ 22 - 22
lib/Marker.js

@@ -8,10 +8,10 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
 
 function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
 
-import React, { Component, PureComponent } from 'react';
-import PropTypes from 'prop-types';
-import { createMarker, updateMarker } from './api';
-var __com__ = 'Marker';
+import React, { Component, PureComponent } from "react";
+import PropTypes from "prop-types";
+import { createMarker, updateMarker } from "./api";
+var __com__ = "Marker";
 //const debug = console.log;
 var debug = function debug() {};
 
@@ -25,19 +25,19 @@ export var Marker = function (_Component) {
 
     _this.refElement = null;
     _this._entity = null;
-    debug(__com__, 'constructor', _this._entity);
+    debug(__com__, "constructor", _this._entity);
     return _this;
   }
 
   _createClass(Marker, [{
-    key: 'componentWillMount',
+    key: "componentWillMount",
     value: function componentWillMount() {
-      debug(__com__, 'componentWillMount', this.props.children, this._entity);
+      debug(__com__, "componentWillMount", this.props.children, this._entity);
     }
   }, {
-    key: 'componentDidMount',
+    key: "componentDidMount",
     value: function componentDidMount() {
-      debug(__com__, 'componentDidMount', this.props.children, this._entity);
+      debug(__com__, "componentDidMount", this.props.children, this._entity);
       var _props = this.props,
           __map__ = _props.__map__,
           options = _props.options,
@@ -47,24 +47,24 @@ export var Marker = function (_Component) {
 
       var opts = _extends({}, options || {}, { map: __map__ });
       this._entity = createMarker(opts, events);
-      if (this._entity) {
-        if (this.props.refer) this.props.refer(this._entity);
-      }
+      // if (this._entity) {
+      //   if (this.props.refer) this.props.refer(this._entity);
+      // }
     }
   }, {
-    key: 'componentWillReceiveProps',
+    key: "componentWillReceiveProps",
     value: function componentWillReceiveProps(nextProps) {
-      debug(__com__, 'componentWillReceiveProps', this.props.children, this._entity);
+      debug(__com__, "componentWillReceiveProps", this.props.children, this._entity);
     }
   }, {
-    key: 'componentWillUpdate',
+    key: "componentWillUpdate",
     value: function componentWillUpdate() {
-      debug(__com__, 'componentWillUpdate', this.props.children, this._entity);
+      debug(__com__, "componentWillUpdate", this.props.children, this._entity);
     }
   }, {
-    key: 'componentDidUpdate',
+    key: "componentDidUpdate",
     value: function componentDidUpdate(prevProps) {
-      debug(__com__, 'componentDidUpdate', this.props.children, this._entity);
+      debug(__com__, "componentDidUpdate", this.props.children, this._entity);
       var _props2 = this.props,
           __map__ = _props2.__map__,
           options = _props2.options,
@@ -89,9 +89,9 @@ export var Marker = function (_Component) {
       updateMarker(this._entity, opts, events, oldOpts, prevProps.events);
     }
   }, {
-    key: 'componentWillUnmount',
+    key: "componentWillUnmount",
     value: function componentWillUnmount() {
-      debug(__com__, 'componentWillUnmount', this.props.children, this._entity);
+      debug(__com__, "componentWillUnmount", this.props.children, this._entity);
       if (this._entity) {
         //   this._entity.clearMap();
         this._entity.stopMove();
@@ -114,9 +114,9 @@ export var Marker = function (_Component) {
     // }
 
   }, {
-    key: 'render',
+    key: "render",
     value: function render() {
-      debug(__com__, 'render', this._entity);
+      debug(__com__, "render", this._entity);
       return null;
     }
   }]);

+ 98 - 57
lib/api.js

@@ -2,24 +2,21 @@ var _extends = Object.assign || function (target) { for (var i = 1; i < argument
 
 function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
 
-import forOwn from 'lodash/forOwn';
-import isEqual from 'lodash/isEqual';
-import isNil from 'lodash/isNil';
-import isEmpty from 'lodash/isEmpty';
+import { isEmpty, isNil, isEqual, forOwn } from "lodash-es";
 //import loadjscssfile from './loadScript';
-import APILoader from './APILoader';
+import APILoader from "./APILoader";
 
 var xdebug = console.log;
 // const xdebug = () => {};
 
 export var loadApi = function loadApi() {
-  var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '0325e3d6d69cd56de4980b4f28906fd8';
+  var key = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "0325e3d6d69cd56de4980b4f28906fd8";
 
   return new APILoader({
     key: key,
     useAMapUI: true,
-    version: '1.4.7',
-    protocol: 'https'
+    version: "1.4.7",
+    protocol: "https"
   }).load();
 };
 export var loadMap = function loadMap(key) {
@@ -31,10 +28,10 @@ export var loadMap = function loadMap(key) {
       if (window.AMap) {
         resolve(window.AMap);
       } else {
-        reject(new Error('window.AMap不存在!'));
+        reject(new Error("window.AMap不存在!"));
       }
     }).catch(function (error) {
-      reject(new Error('加载地图错误!' + error.message));
+      reject(new Error("加载地图错误!" + error.message));
     });
   });
 };
@@ -80,7 +77,7 @@ export var loadPlugin = function loadPlugin(name) {
       });
       //是否有加载失败的情况,如果加载失败,怎么reject?
     } else {
-      reject(new Error('地图还未加载!'));
+      reject(new Error("地图还未加载!"));
     }
   });
 };
@@ -89,11 +86,11 @@ export var loadPlugin = function loadPlugin(name) {
 // 工具方法
 ////////////////////////////////////////////////////////////
 var commonUpdate = function commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators) {
-  var __func__ = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : 'commonUpdate';
+  var __func__ = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : "commonUpdate";
 
   // const __func__ = 'commonUpdate';
   if (!entity) {
-    xdebug(__func__, 'fail! no entity!');
+    xdebug(__func__, "fail! no entity!");
     return false;
   }
 
@@ -165,11 +162,11 @@ var commonUpdate = function commonUpdate(entity, newOptions, newEvents, oldOptio
         func(value);
       } else {
         // ignore properties can not set.
-        xdebug(__func__, 'warning! no setter! can not update ' + key);
+        xdebug(__func__, "warning! no setter! can not update " + key);
       }
     } else {
       // key removed, not support!
-      xdebug(__func__, 'warning! remove prop not support! key=' + key);
+      xdebug(__func__, "warning! remove prop not support! key=" + key);
     }
   });
   forOwn(events, function (value, key) {
@@ -182,7 +179,7 @@ var commonUpdate = function commonUpdate(entity, newOptions, newEvents, oldOptio
     }
   });
   if (!isEmpty(props) || !isEmpty(events)) {
-    xdebug(__func__, 'update:', entity, props, events
+    xdebug(__func__, "update:", entity, props, events
     // newOptions,
     // newEvents,
     // oldOptions,
@@ -196,21 +193,21 @@ var commonUpdate = function commonUpdate(entity, newOptions, newEvents, oldOptio
 // Map
 ////////////////////////////////////////////////////////////
 export var createMap = function createMap(dom, options, events) {
-  var __func__ = 'createMap';
+  var __func__ = "createMap";
   if (!window.AMap) {
-    xdebug(__func__, 'fail! no window.AMap!');
+    xdebug(__func__, "fail! no window.AMap!");
     return null;
   }
   if (!dom) {
-    xdebug(__func__, 'fail! no dom!');
+    xdebug(__func__, "fail! no dom!");
     return null;
   }
   var map = new window.AMap.Map(dom, _extends({}, options || {}));
   forOwn(events, function (value, key) {
-    xdebug(__func__, 'event on ' + key);
+    xdebug(__func__, "event on " + key);
     map.on(key, value);
   });
-  xdebug(__func__, 'ok!');
+  xdebug(__func__, "ok!");
   return map;
 };
 
@@ -279,7 +276,7 @@ export var updateMap = function updateMap(map, newOptions, newEvents, oldOptions
     skyColor: null,
     preloadMode: null
   };
-  return commonUpdate(map, newOptions, newEvents, oldOptions, oldEvents, operators, 'updateMap');
+  return commonUpdate(map, newOptions, newEvents, oldOptions, oldEvents, operators, "updateMap");
 };
 
 ////////////////////////////////////////////////////////////
@@ -293,17 +290,17 @@ export var updateMap = function updateMap(map, newOptions, newEvents, oldOptions
  * @param {*} events
  */
 export var createMarker = function createMarker(options, events) {
-  var __func__ = 'createMarker';
+  var __func__ = "createMarker";
   if (!window.AMap) {
-    xdebug(__func__, 'fail! no window.AMap!');
+    xdebug(__func__, "fail! no window.AMap!");
     return null;
   }
   if (!options) {
-    xdebug(__func__, 'fail! no options!');
+    xdebug(__func__, "fail! no options!");
     return null;
   }
   if (!options.map) {
-    xdebug(__func__, 'fail! no options.map!');
+    xdebug(__func__, "fail! no options.map!");
     return null;
   }
   // let marker = new AMap.Marker({
@@ -315,7 +312,7 @@ export var createMarker = function createMarker(options, events) {
   forOwn(events, function (value, key) {
     entity.on(key, value);
   });
-  xdebug(__func__, 'ok!');
+  xdebug(__func__, "ok!");
   return entity;
 };
 
@@ -378,7 +375,7 @@ export var updateMarker = function updateMarker(entity, newOptions, newEvents, o
     }
   };
 
-  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, 'updateMarker');
+  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, "updateMarker");
 };
 
 ////////////////////////////////////////////////////////////
@@ -392,21 +389,21 @@ export var updateMarker = function updateMarker(entity, newOptions, newEvents, o
  * @param {*} events
  */
 var createTraffic = function createTraffic(options, events) {
-  var __func__ = 'createTraffic';
+  var __func__ = "createTraffic";
   if (!window.AMap || !options || !options.map) {
-    xdebug(__func__, 'fail! parameters!', 'window.AMap:' + !!window.AMap, 'options:' + !!options, 'options.map:' + !!(options && options.map));
+    xdebug(__func__, "fail! parameters!", "window.AMap:" + !!window.AMap, "options:" + !!options, "options.map:" + !!(options && options.map));
     return null;
   }
 
   var map = options.map,
-      restOpts = _objectWithoutProperties(options, ['map']);
+      restOpts = _objectWithoutProperties(options, ["map"]);
 
   var entity = new window.AMap.TileLayer.Traffic(restOpts);
   forOwn(events, function (value, key) {
     entity.on(key, value);
   });
   entity.setMap(map);
-  xdebug(__func__, 'ok!');
+  xdebug(__func__, "ok!");
   return entity;
 };
 
@@ -431,7 +428,7 @@ export var updateTraffic = function updateTraffic(entity, newOptions, newEvents,
     } // not in options.
   };
 
-  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, 'updateTraffic');
+  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, "updateTraffic");
 };
 
 ////////////////////////////////////////////////////////////
@@ -445,23 +442,25 @@ export var updateTraffic = function updateTraffic(entity, newOptions, newEvents,
  * @param {*} events
  */
 var createMassMarks = function createMassMarks(options, events) {
-  var __func__ = 'createMassMarks';
+  var __func__ = "createMassMarks";
   if (!window.AMap || !options || !options.map) {
-    xdebug(__func__, 'fail! parameters!', 'window.AMap:' + !!window.AMap, 'options:' + !!options, 'options.map:' + !!(options && options.map));
+    xdebug(__func__, "fail! parameters!", "window.AMap:" + !!window.AMap, "options:" + !!options, "options.map:" + !!(options && options.map));
     return null;
   }
 
   var map = options.map,
       data = options.data,
       style = options.style,
-      restOpts = _objectWithoutProperties(options, ['map', 'data', 'style']);
+      restOpts = _objectWithoutProperties(options, ["map", "data", "style"]);
 
-  var entity = new window.AMap.MassMarks(data || [], _extends({}, restOpts, { style: style || [] }));
+  var entity = new window.AMap.MassMarks(data || [], _extends({}, restOpts, {
+    style: style || []
+  }));
   forOwn(events, function (value, key) {
     entity.on(key, value);
   });
   entity.setMap(map);
-  xdebug(__func__, 'ok!', map, 'layers:', map.getLayers());
+  xdebug(__func__, "ok!", map, "layers:", map.getLayers());
   return entity;
 };
 
@@ -481,16 +480,16 @@ export var updateMassMarks = function updateMassMarks(entity, newOptions, newEve
       return entity.setStyle(v);
     },
     map: function map(v) {
-      xdebug('updateMassMarks', 'setMap', v, 'layers:', v && v.getLayers());
+      xdebug("updateMassMarks", "setMap", v, "layers:", v && v.getLayers());
       entity.setMap(v);
     },
     data: function data(v) {
       entity.setData(v);
     }
   };
-  xdebug('updateMassMarks', 'mapOld:', oldOptions && oldOptions.map && oldOptions.map.getLayers(), 'mapNew:', newOptions && newOptions.map && newOptions.map.getLayers());
+  xdebug("updateMassMarks", "mapOld:", oldOptions && oldOptions.map && oldOptions.map.getLayers(), "mapNew:", newOptions && newOptions.map && newOptions.map.getLayers());
 
-  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, 'updateMassMarks');
+  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, "updateMassMarks");
 };
 
 ////////////////////////////////////////////////////////////
@@ -504,16 +503,16 @@ export var updateMassMarks = function updateMassMarks(entity, newOptions, newEve
  * @param {*} events
  */
 export var createPolygon = function createPolygon(options, events) {
-  var __func__ = 'createPolygon';
+  var __func__ = "createPolygon";
   if (!window.AMap || !options || !options.map) {
-    xdebug(__func__, 'fail! parameters!', 'window.AMap:' + !!window.AMap, 'options:' + !!options, 'options.map:' + !!(options && options.map));
+    xdebug(__func__, "fail! parameters!", "window.AMap:" + !!window.AMap, "options:" + !!options, "options.map:" + !!(options && options.map));
     return null;
   }
   var entity = new window.AMap.Polygon(options);
   forOwn(events, function (value, key) {
     entity.on(key, value);
   });
-  xdebug(__func__, 'ok!');
+  xdebug(__func__, "ok!");
   return entity;
 };
 
@@ -546,7 +545,7 @@ export var updatePolygon = function updatePolygon(entity, newOptions, newEvents,
     }
   };
 
-  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, 'updatePolygon');
+  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, "updatePolygon");
 };
 
 ////////////////////////////////////////////////////////////
@@ -560,16 +559,16 @@ export var updatePolygon = function updatePolygon(entity, newOptions, newEvents,
  * @param {*} events
  */
 export var createCircle = function createCircle(options, events) {
-  var __func__ = 'createCircle';
+  var __func__ = "createCircle";
   if (!window.AMap || !options || !options.map) {
-    xdebug(__func__, 'fail! parameters!', 'window.AMap:' + !!window.AMap, 'options:' + !!options, 'options.map:' + !!(options && options.map));
+    xdebug(__func__, "fail! parameters!", "window.AMap:" + !!window.AMap, "options:" + !!options, "options.map:" + !!(options && options.map));
     return null;
   }
   var entity = new window.AMap.Circle(options);
   forOwn(events, function (value, key) {
     entity.on(key, value);
   });
-  xdebug(__func__, 'ok!');
+  xdebug(__func__, "ok!");
   return entity;
 };
 
@@ -604,7 +603,7 @@ export var updateCircle = function updateCircle(entity, newOptions, newEvents, o
     }
   };
 
-  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, 'updateCircle');
+  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, "updateCircle");
 };
 
 ////////////////////////////////////////////////////////////
@@ -618,16 +617,16 @@ export var updateCircle = function updateCircle(entity, newOptions, newEvents, o
  * @param {*} events
  */
 export var createPolyline = function createPolyline(options, events) {
-  var __func__ = 'createPolyline';
+  var __func__ = "createPolyline";
   if (!window.AMap || !options || !options.map) {
-    xdebug(__func__, 'fail! parameters!', 'window.AMap:' + !!window.AMap, 'options:' + !!options, 'options.map:' + !!(options && options.map));
+    xdebug(__func__, "fail! parameters!", "window.AMap:" + !!window.AMap, "options:" + !!options, "options.map:" + !!(options && options.map));
     return null;
   }
   var entity = new window.AMap.Polyline(options);
   forOwn(events, function (value, key) {
     entity.on(key, value);
   });
-  xdebug(__func__, 'ok!');
+  xdebug(__func__, "ok!");
   return entity;
 };
 
@@ -665,7 +664,7 @@ export var updatePolyline = function updatePolyline(entity, newOptions, newEvent
     }
   };
 
-  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, 'updatePolyline');
+  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, "updatePolyline");
 };
 
 ////////////////////////////////////////////////////////////
@@ -679,16 +678,16 @@ export var updatePolyline = function updatePolyline(entity, newOptions, newEvent
  * @param {*} events
  */
 export var createInfoWindow = function createInfoWindow(options, events) {
-  var __func__ = 'createInfoWindow';
+  var __func__ = "createInfoWindow";
   if (!window.AMap || !options || !options.map) {
-    xdebug(__func__, 'fail! parameters!', 'window.AMap:' + !!window.AMap, 'options:' + !!options, 'options.map:' + !!(options && options.map));
+    xdebug(__func__, "fail! parameters!", "window.AMap:" + !!window.AMap, "options:" + !!options, "options.map:" + !!(options && options.map));
     return null;
   }
   var entity = new window.AMap.InfoWindow(options);
   forOwn(events, function (value, key) {
     entity.on(key, value);
   });
-  xdebug(__func__, 'ok!');
+  xdebug(__func__, "ok!");
   return entity;
 };
 
@@ -710,5 +709,47 @@ export var updateInfoWindow = function updateInfoWindow(entity, newOptions, newE
     showShadow: null
   };
 
-  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, 'updateInfoWindow');
+  return commonUpdate(entity, newOptions, newEvents, oldOptions, oldEvents, operators, "updateInfoWindow");
+};
+
+////////////////////////////////////////////////////////////
+// Geolocation
+////////////////////////////////////////////////////////////
+
+export var getLocation = function getLocation(options, events) {
+  xdebug("准备获取地理位置");
+  /***************************************
+  由于Chrome、IOS10等已不再支持非安全域的浏览器定位请求,为保证定位成功率和精度,请尽快升级您的站点到HTTPS。
+  ***************************************/
+  var map = options.map;
+  if (!map) {
+    return false;
+  }
+  var geolocation = void 0;
+
+  var defaultOptions = {
+    enableHighAccuracy: true, //是否使用高精度定位,默认:true
+    timeout: 10000, //超过10秒后停止定位,默认:无穷大
+    buttonOffset: new window.AMap.Pixel(10, 20), //定位按钮与设置的停靠位置的偏移量,默认:Pixel(10, 20)
+    zoomToAccuracy: true, //定位成功后调整地图视野范围使定位位置及精度范围视野内可见,默认:false
+    buttonPosition: "RB"
+  };
+
+  var opts = _extends({}, defaultOptions, options);
+  xdebug("准备加载定位插件");
+
+  map.plugin("AMap.Geolocation", function () {
+    xdebug("加载定位插件成功");
+
+    geolocation = new window.AMap.Geolocation(opts);
+    map.addControl(geolocation);
+    geolocation.getCurrentPosition();
+    if (events.onComplete) {
+      window.AMap.event.addListener(geolocation, "complete", events.onComplete); //返回定位信息
+    }
+    if (events.onError) {
+      window.AMap.event.addListener(geolocation, "error", events.onError); //返回定位出错信息
+    }
+  });
+  return true;
 };

+ 1 - 1
lib/loadScript.js

@@ -1,7 +1,7 @@
 /**
  * see: http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml
  */
-import indexOf from 'lodash/indexOf';
+import { indexOf } from "lodash-es";
 
 var gFileList = []; //list of files already added
 var loadjscssfile = function loadjscssfile(filename, filetype) {

+ 1 - 4
lib/webservice.js

@@ -1,9 +1,6 @@
 var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
 
-import forOwn from 'lodash/forOwn';
-import isEqual from 'lodash/isEqual';
-import isNil from 'lodash/isNil';
-import isUndefined from 'lodash/isUndefined';
+import { isUndefined, isNil, isEqual, forOwn } from "lodash-es";
 
 // M: Mandatory,必选
 // api调用限流说明: https://lbs.amap.com/api/webservice/guide/tools/flowlevel

+ 1 - 0
package.json

@@ -9,6 +9,7 @@
     "amap",
     "高德地图"
   ],
+  "main":"lib/index.js",
   "homepage": "https://github.com/windsome/react-amap-next",
   "author": "windsome.feng <36081189@qq.com> (https://github.com/windsome/)",
   "scripts": {

+ 6 - 15
src/App.js

@@ -17,8 +17,8 @@ class MarkerTest extends Component {
   constructor() {
     super();
     this.state = {};
-    this._setMapRefer = this._setMapRefer.bind(this);
-    this._setMarkerRefer = this._setMarkerRefer.bind(this);
+    // this._setMapRefer = this._setMapRefer.bind(this);
+    // this._setMarkerRefer = this._setMarkerRefer.bind(this);
   }
 
   componentDidMount() {
@@ -26,16 +26,7 @@ class MarkerTest extends Component {
       this.setState({ AMap });
     });
   }
-  _setMapRefer(refer) {
-    this.mapRefer = refer;
-    window.$map = this.mapRefer;
-    console.log("_setMapRefer:", this.mapRefer, this.markerRefer);
-  }
-  _setMarkerRefer(refer) {
-    this.markerRefer = refer;
-    window.$marker = this.markerRefer;
-    console.log("_setMarkerRefer:", this.mapRefer, this.markerRefer);
-  }
+ 
 
   onComplete(data) {
     console.log("定位成功回调:", data);
@@ -47,8 +38,8 @@ class MarkerTest extends Component {
 
   render() {
     let center = [116.39, 39.9];
-    window.$map = this.mapRefer;
-    window.$marker = this.markerRefer;
+    // window.$map = this.mapRefer;
+    // window.$marker = this.markerRefer;
     console.log("render:", this.mapRefer, this.markerRefer);
     let markerIcon = "https://webapi.amap.com/theme/v1.3/markers/n/mark_b.png";
     switch (this.state.markerIndex) {
@@ -76,7 +67,7 @@ class MarkerTest extends Component {
             </span>
           </div>
           <Map
-            refer={this._setMapRefer}
+            // refer={this._setMapRefer}
             style={{ width: 1200, height: 800 }}
             options={{ center, zoom: 13 }}
           >

+ 2 - 2
src/lib/api.js

@@ -2,8 +2,8 @@ import {isEmpty,isNil,isEqual,forOwn} from "lodash-es"
 //import loadjscssfile from './loadScript';
 import APILoader from "./APILoader";
 
-// const xdebug = console.log;
-const xdebug = () => {};
+const xdebug = console.log;
+// const xdebug = () => {};
 
 export const loadApi = (key = "0325e3d6d69cd56de4980b4f28906fd8") => {
   return new APILoader({