From 4ad35009405070b5a8d2364f4ea418b73fc25252 Mon Sep 17 00:00:00 2001 From: rennai Date: Fri, 27 Apr 2018 11:50:08 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Map=E7=BB=84=E4=BB=B6=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=20load=20=E4=BA=8B=E4=BB=B6=E5=90=8E=E4=B8=8D=E8=A7=A6?= =?UTF-8?q?=E5=8F=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在给 Map组件绑定 load 事件后,刷新地图。load事件没有触发 --- src/components/map.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/map.js b/src/components/map.js index 0135709..a728784 100644 --- a/src/components/map.js +++ b/src/components/map.js @@ -139,6 +139,9 @@ export default class Map extends Component { } var zoom = this.props.zoom; + + // 在 centerAndZoom() 之前执行事件绑定否则load无法正常触发 + this.bindEvent(map, this.events); if (isString(this.props.center)) { // 可以传入城市名 map.centerAndZoom(this.props.center); @@ -148,7 +151,6 @@ export default class Map extends Component { } this.bindToggleMeghods(map, this.toggleMethods); - this.bindEvent(map, this.events); var lastZoom = zoom; map.addEventListener('zoomend', () => {