Browse Source

打点调整

Hwf 3 months ago
parent
commit
8e7e8cd55c
2 changed files with 10 additions and 11 deletions
  1. 2 1
      src/components/Map/index.vue
  2. 8 10
      src/hooks/AMap/useAMap.ts

+ 2 - 1
src/components/Map/index.vue

@@ -340,7 +340,8 @@ defineExpose({
   handleHover,
   trackPlayback,
   getMapUtils,
-  getPlaceSearch
+  getPlaceSearch,
+  getMapDomSize
 });
 </script>
 

+ 8 - 10
src/hooks/AMap/useAMap.ts

@@ -15,7 +15,7 @@ export function useAMap(options) {
   let layers = [];
   let defaultLayer;
   // 标绘图层
-  let plotLayers = [];
+  const plotLayers = [];
   // 标绘层级
   let activeLayerkey;
   // 初始化事件
@@ -325,21 +325,19 @@ export function useAMap(options) {
     });
   };
   const getContent = (icon: string, size: number[], name?: string, color?: string = '#000') => {
-    const content =
-      '<div style="display: flex;flex-direction: column;align-items: center;justify-content: center">' +
+    let content =
+      '<div style="display: flex;flex-direction: column;align-items: center;justify-content: center;cursor: pointer">' +
       '<div style="background: url(' +
       icon +
       ') no-repeat; width: ' +
       size[0] +
       'px;height: ' +
       size[1] +
-      'px;cursor: pointer; background-size: cover"></div>' +
-      '<div style="font-size: 16px;white-space: nowrap; font-weight: bold;color:' +
-      color +
-      '">' +
-      name +
-      '</div>' +
-      '</div>';
+      'px;cursor: pointer; background-size: cover"></div>';
+    if (!!name) {
+      content += '<div style="font-size: 16px;white-space: nowrap; font-weight: bold;color:' + color + '">' + name + '</div>';
+    }
+    content += '</div>';
     return content;
   };
   // 清除所有标加