hear 3 лет назад
Родитель
Сommit
c380787519
2 измененных файлов с 19 добавлено и 15 удалено
  1. 12 0
      src/pages/device/DashBoard/index.less
  2. 7 15
      src/pages/device/DashBoard/index.tsx

+ 12 - 0
src/pages/device/DashBoard/index.less

@@ -46,4 +46,16 @@
       }
     }
   }
+
+  .amap-marker-label {
+    top: -26px !important;
+    padding: 3px;
+    font-size: 14px;
+    line-height: 18px;
+    background-color: #666;
+    border: none;
+    .amap {
+      color: #e3e3e3;
+    }
+  }
 }

+ 7 - 15
src/pages/device/DashBoard/index.tsx

@@ -607,22 +607,14 @@ const DeviceBoard = () => {
                       longitude: item.geometry.coordinates?.[0],
                       latitude: item.geometry.coordinates?.[1],
                     }}
-                    offset={[-10, -34]}
+                    offset={[-10, -20]}
+                    label={{
+                      content: `<div class='amap'>${item.properties.deviceName}</div>`,
+                      direction: 'top',
+                    }}
+                    // icon={''}
                   >
-                    <div>
-                      <div
-                        style={{
-                          backgroundColor: '#666666',
-                          color: 'white',
-                          textAlign: 'center',
-                        }}
-                      >
-                        {item.properties.deviceName}
-                      </div>
-                      <div>
-                        <EnvironmentOutlined style={{ color: 'blue', fontSize: 22 }} />
-                      </div>
-                    </div>
+                    <EnvironmentOutlined style={{ color: 'blue', fontSize: 22 }} />
                   </Marker>
                 ))}
               </AMap>