From fb553082d97d0e573e7142d213f39dd6eb74f80b Mon Sep 17 00:00:00 2001 From: duanxiaohai <1812246227@qq.com> Date: Fri, 30 Aug 2024 11:24:49 +0800 Subject: [PATCH] gx --- src/view/sy_map.vue | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/view/sy_map.vue b/src/view/sy_map.vue index 4487aa9..860cec5 100644 --- a/src/view/sy_map.vue +++ b/src/view/sy_map.vue @@ -2504,11 +2504,45 @@ const createZyys = (polygon, indexx, name) => { content.style.zIndex = BMapGL.Overlay.getZIndex(this.point.lat); content.style.height = "30px"; content.style.width = "30px"; + // content.style.position = "relative"; // 使得提示文字相对于父元素定位 + let img2 = document.createElement("img"); img2.style.width = "20px"; img2.style.height = "26px"; img2.src = this.properties.imgSrc2; + + // 添加 title 属性作为简单的文字提示 + img2.title = "这是一个图标的提示文字"; + // // 创建一个提示文字的元素 + // let tooltip = document.createElement("div"); + // tooltip.textContent = "这是一个图标的提示文字"; + // tooltip.style.visibility = "hidden"; + // tooltip.style.backgroundColor = "black"; + // tooltip.style.color = "#fff"; + // tooltip.style.textAlign = "center"; + // tooltip.style.borderRadius = "5px"; + // tooltip.style.padding = "5px"; + // tooltip.style.position = "absolute"; + // tooltip.style.bottom = "100%"; // 调整提示文字的位置 + // tooltip.style.left = "50%"; + // tooltip.style.transform = "translateX(-50%)"; + // tooltip.style.zIndex = "1"; + + // // 鼠标悬停时显示提示文字 + // content.addEventListener("mouseover", function() { + // console.log(556); + + // tooltip.style.visibility = "visible"; + // }); + + // // 鼠标移开时隐藏提示文字 + // content.addEventListener("mouseout", function() { + // tooltip.style.visibility = "hidden"; + // }); + content.appendChild(img2); + // content.appendChild(tooltip); + return content; } yaosuIcon.value[name].sj[indexx].overlay = new BMapGL.CustomOverlay(