Procházet zdrojové kódy

fix: 调整google地图显示逻辑

周玉环 před 2 dny
rodič
revize
a9d4e29dc9

+ 2 - 2
xinkeaboard-web/pages/home/contact.vue

@@ -162,7 +162,7 @@
             </el-form>
           </div>
         </div>
-        <div v-if="ifMapReload && center.lat != ''">
+        <div v-if="ifMapReload && center.lat && center.lng">
           <GoogleMap
             api-key="AIzaSyAvTVnnDLfxdaK2i-f0pRMJOrdwZvxUBjU"
             style="width: 100%; height: 500px"
@@ -195,7 +195,7 @@ import { getCurLanguage } from "@/composables/common.js";
 import { getContactType } from "../../utils/common";
 
 const L = getCurLanguage();
-const center = { lat: "", lng: "" };
+const center = reactive({ lat: "", lng: "" });
 const route = useRoute();
 const router = useRouter();
 const vid = route.query.vid;

+ 6 - 6
xinkeaboard-web/pages/store/contact/[contact].vue

@@ -151,14 +151,14 @@
           </el-form>
         </div>
       </div>
-      <div v-if="ifMapReload && center.data.lat != ''">
+      <div v-if="ifMapReload && center.lat && center.lng">
         <GoogleMap
           api-key="AIzaSyAvTVnnDLfxdaK2i-f0pRMJOrdwZvxUBjU"
           style="width: 100%; height: 500px"
-          :center="center.data"
+          :center="center"
           :zoom="5"
           >
-            <Marker :options="{ position: center.data }" />
+            <Marker :options="{ position: center }" />
           </GoogleMap>
 
       </div>
@@ -184,7 +184,7 @@ import { getCurLanguage } from '@/composables/common.js';
 import { getContactType } from "@/utils/common";
 
 const L = getCurLanguage();
-const center = reactive({data:{ lat: 0, lng: 0 }})
+const center = reactive({lat: '', lng: '' })
 const address = ref()
 const email = ref()
 const phone = ref()
@@ -360,8 +360,8 @@ const getMapInfo = () => {
     address.value = res.data.address
     email.value = res.data.email
     phone.value = res.data.servicePhone
-    center.data.lat = Number(res.data.storeMapInfo)
-    center.data.lng = Number(res.data.storeMapInfoW)
+    center.lat = Number(res.data.storeMapInfo)
+    center.lng = Number(res.data.storeMapInfoW)
     ifMapReload.value =true
   })