| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, onUnmounted } from 'vue'; |
| | | import { createMap, map, destroyMap } from '@/utils/map/index'; |
| | | import { onMounted, onUnmounted } from 'vue' |
| | | import { onMapMounted, createMap, satellite, map, destroyMap } from '@/utils/map/index' |
| | | const props = defineProps({ |
| | | showSatellite: { |
| | | type: Boolean, |
| | | default: false, |
| | | }, |
| | | }) |
| | | onMounted(() => { |
| | | // 高德地图初始化 |
| | | setTimeout(() => { |
| | | createMap('container'); |
| | | }, 1000); |
| | | }); |
| | | createMap('container') |
| | | onMapMounted(() => { |
| | | if (props.showSatellite) { |
| | | satellite.show() |
| | | } else { |
| | | satellite.hide() |
| | | } |
| | | }) |
| | | }, 1000) |
| | | }) |
| | | onUnmounted(() => { |
| | | destroyMap(); |
| | | }); |
| | | destroyMap() |
| | | }) |
| | | </script> |
| | | <style> |
| | | #container { |