Your Name 3 年之前
父节点
当前提交
7aab1f0610
共有 3 个文件被更改,包括 49 次插入6 次删除
  1. 1 0
      src/components/MarkerMap/dialog.ts
  2. 19 0
      src/components/MarkerMap/index.scss
  3. 29 6
      src/components/MarkerMap/index.tsx

+ 1 - 0
src/components/MarkerMap/dialog.ts

@@ -257,6 +257,7 @@ export const renderElement = (image: any) => {
   el.style.minWidth = '24px';
   el.style.height = (25 * 2) / 576 + 'rem';
   el.style.minHeight = '25px';
+  el.className = "pointerc"
 
   return el;
 };

+ 19 - 0
src/components/MarkerMap/index.scss

@@ -164,6 +164,24 @@
         }
     }
     .minemap-map {
+        .tipc{
+            z-index: 11111;
+            position:absolute;
+            top:-50px;
+            transform: translateX(-50%);
+            padding:10px;
+            height:20px;
+            background:blue;
+            color: white;
+            min-width:fit-content;
+            width: fit-content;
+            white-space: nowrap;
+    
+        }
+        .pointerc:hover{
+            cursor: pointer;
+        }
+        
         .minemap-popup-tip {
             display: none;
         }
@@ -270,6 +288,7 @@
                     }
                 }
             }
+           
         }
     }
     .address-type-card-container {

+ 29 - 6
src/components/MarkerMap/index.tsx

@@ -786,15 +786,38 @@ export default defineComponent({
                },
              );
           });
+          // popup.on('onmouseup',function(){
+          //   alert(11)
+          // });
+          
+          // popup.getElement().onmouseout = ()=>{
+          //   alert(12)
+          // }
+          // debugger
+
+         var imagep= renderElement(nextImage);
+        var markp = 
+              new window.minemap.Marker(imagep, {
+                offset: [-25, -25],
+              });
+
+        imagep.onmouseover = ()=>{
+          //console.log(222)
+         
+           imagep.innerHTML = `<div style="position:relative"><div class="tipc">${i.name}</div></div>`
+           markp.setZIndex(111);
+        };
+        imagep.onmouseout = ()=>{
+         
+            imagep.innerHTML = "";
+            markp.setZIndex(0);
+        };
+            
+
           return {
             locations: i.locations,
             popup,
-            marker:
-              i.locations &&
-              new window.minemap.Marker(renderElement(nextImage), {
-                offset: [-25, -25],
-              })
-                .setLngLat({
+            marker: i.locations && markp.setLngLat({
                   lng: ((i) => { var ii = parseFloat(i.locations?.split(',')[0] ?? "0"); return ii; })(i),
                   lat: ((i) => { var ii = parseFloat(i.locations?.split(',')[1] ?? "0"); return ii>90?89:ii<-90?-89:ii; })(i) ,
                 })