map.vue 730 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <template>
  2. <div class="mapContainer">
  3. <el-amap
  4. :center="center"
  5. :zoom="zoom"
  6. map-style="amap://styles/grey"
  7. @init="_init"
  8. />
  9. </div>
  10. </template>
  11. <script setup lang='ts'>
  12. import { ElAmap } from '@vuemap/vue-amap'
  13. import { ref } from 'vue'
  14. withDefaults(defineProps<{
  15. zoom?: number
  16. }>(), {
  17. zoom: 12
  18. })
  19. const center = ref([ 103.044313, 30.011438 ])
  20. let map = null
  21. function _init(e: any) {
  22. const marker = new AMap.Marker({
  23. position: center
  24. })
  25. e.add(marker)
  26. map = e
  27. console.log('map init: ', e)
  28. }
  29. </script>
  30. <style lang="scss" scoped>
  31. .mapContainer {
  32. width: 100%;
  33. height: 100%;
  34. mask-image: radial-gradient(circle at center, #030E25 70%, transparent 76%);
  35. }
  36. </style>