forked from dyf/dyf-vue-ui
电子围栏功能添加
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
var map = null;
|
||||
var circle = null;
|
||||
var polygon = null;
|
||||
|
||||
import mapLocation from '@/assets/images/mapLocation.png';
|
||||
|
||||
function initMap() {
|
||||
// let key = '90bc158992feb8ccd0145e168cab1307';
|
||||
@ -9,12 +9,18 @@ function initMap() {
|
||||
map = new AMap.Map("map", {
|
||||
viewMode: '2D', //默认使用 2D 模式
|
||||
zoom: 11, //地图级别
|
||||
dragEnable: true, // 强制开启拖拽
|
||||
zoomEnable: true, // 开启滚轮缩放(辅助验证)
|
||||
center: [114.420739, 30.487514], //地图中心点
|
||||
});
|
||||
|
||||
map.on('click',function(evt){
|
||||
alert('您点击的位置:'+evt.lnglat.lng+' , '+ evt.lnglat.lat);
|
||||
});
|
||||
|
||||
setTimeout(() => {
|
||||
map.resize();
|
||||
}, 1000);
|
||||
// map.on('click',function(evt){
|
||||
// alert('您点击的位置:'+evt.lnglat.lng+' , '+ evt.lnglat.lat);
|
||||
// });
|
||||
}
|
||||
return new Promise((resolve, reject) => {
|
||||
if(map){
|
||||
@ -39,7 +45,7 @@ function AddPoint(point, index, dragEnd, click) {
|
||||
let center = point ? new AMap.LngLat(point.lng, point.lat) : map.getCenter();
|
||||
|
||||
let marker = new AMap.Text({
|
||||
icon: "http://wdxm.ztzhtech.com:8111/Script/Home/img/welComeImg/mapLocation.png",
|
||||
icon: mapLocation,
|
||||
position: center,
|
||||
offset: new AMap.Pixel(-15, -24),
|
||||
draggable: true,
|
||||
|
||||
Reference in New Issue
Block a user