From b09ed762edb698bb12b11beb28ee7c2de76ceecc Mon Sep 17 00:00:00 2001
From: sean.zhou <sean.zhou@dji.com>
Date: Tue, 14 Mar 2023 19:44:44 +0800
Subject: [PATCH] Fix the issue that the data is not displayed when the map is not loaded.

---
 src/hooks/use-g-map-tsa.ts |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/hooks/use-g-map-tsa.ts b/src/hooks/use-g-map-tsa.ts
index cb29ff8..c36779b 100644
--- a/src/hooks/use-g-map-tsa.ts
+++ b/src/hooks/use-g-map-tsa.ts
@@ -10,7 +10,7 @@
 
 export function deviceTsaUpdate () {
   const root = getRoot()
-  const AMap = root.$aMap
+  let AMap = root.$aMap
 
   const icons = new Map([
     [EDeviceTypeName.Aircraft, droneIcon],
@@ -43,8 +43,12 @@
     if (markers[sn]) {
       return
     }
+    if (root.$aMap === undefined) {
+      return
+    }
+    AMap = root.$aMap
     markers[sn] = new AMap.Marker({
-      position: new AMap.LngLat(lng || 113.935913, lat || 22.525335),
+      position: new AMap.LngLat(lng || 113.943225499, lat || 22.577673716),
       icon: initIcon(type),
       title: name,
       anchor: 'top-center',

--
Gitblit v1.9.3