Commit f07a463c by 前端

修复bug

1 parent 193f0a67
...@@ -203,7 +203,7 @@ export default { ...@@ -203,7 +203,7 @@ export default {
}, },
// 地图右键添加poi点 // 地图右键添加poi点
addPoiMarker(options) { addPoiMarker(options, type) {
let _this = this; let _this = this;
let _map = _this.map; let _map = _this.map;
let _InfoWindow = _this.poiInfoWindow; let _InfoWindow = _this.poiInfoWindow;
...@@ -247,6 +247,10 @@ export default { ...@@ -247,6 +247,10 @@ export default {
_this.$set(_this.form, "lat", options.lat); _this.$set(_this.form, "lat", options.lat);
_this.markerEvent(_markerInfo); _this.markerEvent(_markerInfo);
} }
if (type && type == "search") {
_this.setCenter(options.lng, options.lat);
}
}, },
// marker点击事件 // marker点击事件
...@@ -308,7 +312,8 @@ export default { ...@@ -308,7 +312,8 @@ export default {
let _params = {}; let _params = {};
_params.lng = _poi.location.lng; _params.lng = _poi.location.lng;
_params.lat = _poi.location.lat; _params.lat = _poi.location.lat;
_this.addPoiMarker(_params);
_this.addPoiMarker(_params, "search");
}); });
}, },
...@@ -432,7 +437,8 @@ export default { ...@@ -432,7 +437,8 @@ export default {
if (_marker) { if (_marker) {
let _markerInfo = _marker.getExtData(); let _markerInfo = _marker.getExtData();
_this.markerEvent(_markerInfo); _this.markerEvent(_markerInfo);
_this.map.setFitView(_marker); //_this.map.setFitView(_marker);
_this.setCenter(_markerInfo.lng, _markerInfo.lat);
} }
} }
_this.trackList = res.data || []; _this.trackList = res.data || [];
...@@ -455,6 +461,18 @@ export default { ...@@ -455,6 +461,18 @@ export default {
} }
}); });
}, },
// 设置地图中心点
setCenter(lng, lat) {
let _this = this;
let _map = _this.map;
if (_map) {
console.log(lng, lat);
setTimeout(function () {
_map.setCenter([lng, lat]);
}, 1000);
}
},
}, },
}; };
</script> </script>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!