高德地图不同层级是否显示文字记录
2023-02-25 18:19:44 时间
data中设置变量 isShowLabel isShowLabel:"none", // "none":不显示 "block":显示
mounted中执行handleMoveEnd事件,一般地图展示后执行使用setTimeout
handleMoveEnd(){
console.log(this.GDMap.getZoom())
this.GDMap.on("zoomend",()=>{
console.log("zoomend")
let zoom = this.GDMap.getZoom()
if(zoom>11){
if(this.isShowLabel=="none"){
this.showMarkerLabel()
}
}else{
if(this.isShowLabel=="block"){
this.hideMarkerLabel()
}
}
})
},
showMarkerLabel(){
this.isShowLabel = "block"
this.showSiteMarker()
return // 下面层级放大时候标签不在视线区域的会偏移,未找到原因,所以改成重新画点
for(let i=0;i<this.siteMarkers.length;i++){
let label = this.siteMarkers[i].getLabel()
console.log(label)
console.log(label.direction)
let labelContent = label.content.replace("none","block")
this.isShowLabel = "block"
// setTimeout(() => {
this.siteMarkers[i].setLabel({
// direction:label.direction,
direction:"right",
content:labelContent
})
this.siteMarkers[i].on("mouseout", () => {
console.log("moveout")
this.siteMarkers[i].setLabel({
direction:label.direction,
content: labelContent
});
});
// }, 1000);
}
},
为Marker设置Label
let labelContentTitle = `
<div class="mapLabel" style="display:${this.isShowLabel}">
<div class="labelTitle controlShow">${resultList[j].title}</div>
</div>
`;
相关文章
- 当公路的规则与秩序,被昇腾AI时刻守护
- 流程表单初体验
- 世界杯海信再出圈,三星:“谈不上愉悦”
- “20后”新势力,勇闯智能驾驶“寒冬”
- 以生态共建促产业发展,点亮HPC新未来
- 谁在「元宇宙」里卖咖啡?
- 国产软件的「硬替代」与「软着陆」之辨
- 携手华为,瑞金医院病理科为健康数字化保驾护航
- 2023PyCharm激活码(2023PyCharm最新激活码)2023PyCharm激活码
- 新华三“智・行中国2022”|大厂行动,如何擘画“内循环”的数字未来?
- 钉钉的想象力,向企业服务第一平台进阶
- 2022年的5G行业:“5G+”很火,5G网络迟迟未能普及
- 三年“云改”,移动云这份答卷有多“硬”?
- Nacos 中的配置文件如何实现加密传输
- 一图胜千言,实时掌握流程走到哪一步了!
- 什么是插入意向锁?
- 并发扣款,如何保证一致性?
- 微服务中的鉴权该怎么做?
- feed与秒杀,撑住10Wqps,架构方案一样吗?
- 连接池居然这么简单?