Parcourir la source

增加标注标题

Hwf il y a 6 mois
Parent
commit
f9078cd7da

+ 6 - 0
src/components/Map/index.vue

@@ -588,5 +588,11 @@ onUnmounted(() => {
   :deep(.amap-marker) {
     font-size: 16px;
   }
+  :deep(.amap-marker-label) {
+    border: 1px solid #474747;
+    background-color: rgba(255, 255, 255, 0.65);
+    padding: 3px 8px;
+    border-radius: 4px;
+  }
 }
 </style>

+ 5 - 0
src/views/globalMap/RightMenu/OnlinePlotting/index.vue

@@ -546,6 +546,11 @@ const initDrawMethod = (options) => {
       data.icon = data.iconName;
       data.image = data.iconName;
       data.imageHover = data.iconName;
+      data.visible = true;
+      obj.setLabel({
+        content: '<div>' + data.title + '</div>',
+        direction: 'top'
+      });
     } else {
       const path = obj.getPath();
       // 将AMap.LngLat对象数组转换为经纬度数组