Skip to content

Commit

Permalink
fix: Map组件绑定 load 事件后不触发
Browse files Browse the repository at this point in the history
在给 Map组件绑定 load 事件后,刷新地图。load事件没有触发
  • Loading branch information
rennai authored Apr 27, 2018
1 parent 9a39089 commit 4ad3500
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/components/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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', () => {
Expand Down

0 comments on commit 4ad3500

Please sign in to comment.