Commit f5576e06 authored by 耿迪迪's avatar 耿迪迪

经纬度拾取修改 gengdidi

parent b40cfd04
......@@ -32,6 +32,7 @@
</el-dialog>
</template>
<script>
import gaodeMap from "./js/gaodeMapDialog.js";
export default {
props: {
dialogTableVisible: false,
......@@ -54,7 +55,7 @@
let that = this;
that.$nextTick(() => {
//初始化地图
let map = new AMap.Map("container1", {
/*let map = new AMap.Map("container1", {
center: [114.72995, 38.37417],
// resizeEnable: true,
disableSocket: true,
......@@ -62,7 +63,8 @@
showLabel: true,
pitch: 8,
zoom: 12
});
});*/
let gaode = new gaodeMap(process.env.VUE_APP_MAP_CENTER);
var overlays = [];
//坐标回显
if (typeof that.slng == "number" && that.slng != 0) {
......@@ -71,16 +73,16 @@
let marker = new AMap.Marker({
position: [that.slng,that.slat]
});
marker.setMap(map);
map.setCenter([that.slng,that.slat]);
marker.setMap(gaode.myMap);
gaode.myMap.setCenter([that.slng,that.slat]);
overlays.push(marker);
}
//点击获取坐标点
var mouseTool = new AMap.MouseTool(map);
var mouseTool = new AMap.MouseTool(gaode.myMap);
//监听draw事件可获取画好的覆盖物
mouseTool.on('draw',function(e){
map.remove(overlays);
gaode.myMap.remove(overlays);
overlays.push(e.obj);
that.lnglat.lat = e.obj._position.lat;
that.lnglat.lng = e.obj._position.lng;
......@@ -90,7 +92,7 @@
//搜索功能
AMap.plugin(["AMap.AutoComplete","AMap.PlaceSearch"], function() {
that.placeSearch = new AMap.PlaceSearch({
map: map
map: gaode.myMap
});
});
})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment