From 7cf58a4d2fff6b9cba9029d4d43ba9744dbef864 Mon Sep 17 00:00:00 2001
From: Ben Lin <maobin001@msn.com>
Date: 星期四, 18 七月 2024 15:49:03 +0800
Subject: [PATCH] 工单更新

---
 src/views/demo/charts/map/Baidu.vue |   64 +++++++++++++++-----------------
 1 files changed, 30 insertions(+), 34 deletions(-)

diff --git a/src/views/demo/charts/map/Baidu.vue b/src/views/demo/charts/map/Baidu.vue
index ff53def..0420408 100644
--- a/src/views/demo/charts/map/Baidu.vue
+++ b/src/views/demo/charts/map/Baidu.vue
@@ -1,46 +1,42 @@
 <template>
   <div ref="wrapRef" :style="{ height, width }"></div>
 </template>
-<script lang="ts">
-  import { defineComponent, ref, nextTick, unref, onMounted } from 'vue';
+<script lang="ts" setup>
+  import { ref, nextTick, unref, onMounted } from 'vue';
+  import { useScript } from '@/hooks/web/useScript';
 
-  import { useScript } from '/@/hooks/web/useScript';
+  defineOptions({ name: 'BaiduMap' });
+
+  defineProps({
+    width: {
+      type: String,
+      default: '100%',
+    },
+    height: {
+      type: String,
+      default: 'calc(100vh - 78px)',
+    },
+  });
 
   const BAI_DU_MAP_URL =
     'https://api.map.baidu.com/getscript?v=3.0&ak=OaBvYmKX3pjF7YFUFeeBCeGdy9Zp7xB2&services=&t=20210201100830&s=1';
-  export default defineComponent({
-    name: 'BaiduMap',
-    props: {
-      width: {
-        type: String,
-        default: '100%',
-      },
-      height: {
-        type: String,
-        default: 'calc(100vh - 78px)',
-      },
-    },
-    setup() {
-      const wrapRef = ref<HTMLDivElement | null>(null);
-      const { toPromise } = useScript({ src: BAI_DU_MAP_URL });
 
-      async function initMap() {
-        await toPromise();
-        await nextTick();
-        const wrapEl = unref(wrapRef);
-        if (!wrapEl) return;
-        const BMap = (window as any).BMap;
-        const map = new BMap.Map(wrapEl);
-        const point = new BMap.Point(116.404, 39.915);
-        map.centerAndZoom(point, 15);
-        map.enableScrollWheelZoom(true);
-      }
+  const wrapRef = ref<HTMLDivElement | null>(null);
+  const { toPromise } = useScript({ src: BAI_DU_MAP_URL });
 
-      onMounted(() => {
-        initMap();
-      });
+  async function initMap() {
+    await toPromise();
+    await nextTick();
+    const wrapEl = unref(wrapRef);
+    if (!wrapEl) return;
+    const BMap = (window as any).BMap;
+    const map = new BMap.Map(wrapEl);
+    const point = new BMap.Point(116.404, 39.915);
+    map.centerAndZoom(point, 15);
+    map.enableScrollWheelZoom(true);
+  }
 
-      return { wrapRef };
-    },
+  onMounted(async () => {
+    await initMap();
   });
 </script>

--
Gitblit v1.9.3