Ben Lin
2024-06-18 ebbd788fbb2c0b45d4473798efc57eec8ba74a25
src/views/demo/charts/map/Gaode.vue
@@ -1,16 +1,13 @@
<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: 'AMap' });
  const A_MAP_URL = 'https://webapi.amap.com/maps?v=2.0&key=d7bb98e7185300250dd5f918c12f484b';
  export default defineComponent({
    name: 'AMap',
    props: {
  defineProps({
      width: {
        type: String,
        default: '100%',
@@ -19,8 +16,10 @@
        type: String,
        default: 'calc(100vh - 78px)',
      },
    },
    setup() {
  });
  const A_MAP_URL = 'https://webapi.amap.com/maps?v=2.0&key=d7bb98e7185300250dd5f918c12f484b';
      const wrapRef = ref<HTMLDivElement | null>(null);
      const { toPromise } = useScript({ src: A_MAP_URL });
@@ -37,11 +36,7 @@
        });
      }
      onMounted(() => {
        initMap();
      });
      return { wrapRef };
    },
  onMounted(async () => {
    await initMap();
  });
</script>