This commit is contained in:
zk
2023-12-27 18:00:39 +08:00
parent 63eb01d641
commit 36f484d028
13 changed files with 231 additions and 136 deletions
+24
View File
@@ -16,6 +16,7 @@ export const Map = {
airMarkerList: [], //直升机markerList
placeSearch: null, //地点查询
marker: null, // 健康终端报警
infoWindow: null, //地图弹窗
/**
* @desc 地图舒适化
* @param el dom元素 id选择器
@@ -101,6 +102,7 @@ export const Map = {
this.airMarkerList = [];
}
this.clearActiveHospital();
this.clearInfoModal();
// this.map.remove(this.airMarkerList);
}, //
/**
@@ -132,6 +134,8 @@ export const Map = {
position: [lon, lat], // 指定点的icon,也可以是个url ,但这样就不能对图片进行设置了
icon: startIcon, //启用点击事件 如果需要点击事件,必须开启
clickable: true, //点额外携带的数据,用户自定义属性,支持JavaScript API任意数据类型
offset: [-18, -32],
maxZoom: 14,
extData: result[i],
label: {
content: isFunction(extData?.content) && extData?.content(result[i]),
@@ -277,4 +281,24 @@ export const Map = {
this.marker = null;
}
},
/**
* @desc 创建地图详情弹窗
*
* */
createInfoModal({ option, content }) {
let { lat, lng } = option;
this.infoWindow = new AMap.InfoWindow({
position: [lng, lat],
offset: new AMap.Pixel(-5, -25),
content: content,
closeWhenClickMap: true,
});
this.infoWindow.open(this.map);
},
clearInfoModal() {
if (this.infoWindow) {
this.infoWindow?.setMap(null);
this.infoWindow = null;
}
},
};