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

经纬度拾取修改 gengdidi

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