1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
| <script lang="ts" setup>
| import { onMounted } from 'vue';
|
| import AMapLoader from '@amap/amap-jsapi-loader';
|
| defineOptions({ name: 'ExtendMap' });
|
| defineProps({
| width: {
| type: String,
| default: '100%',
| },
| height: {
| type: String,
| default: '100%',
| },
| });
| async function initMap() {
| AMapLoader.load({
| key: import.meta.env.VITE_A_MAP_JS_KEY,
| version: '2.0',
| }).then((AMap) => {
| const query: any = {
| viewMode: '3D',
| zoom: 11,
| center: [116.397428, 39.90923],
| };
| // eslint-disable-next-line no-new
| new AMap.Map('map-container', query);
| });
| }
|
| onMounted(() => {
| initMap();
| });
| </script>
| <template>
| <div class="jnpf-content-wrapper">
| <div class="jnpf-content-wrapper-center">
| <div id="map-container" :style="{ height, width }"></div>
| </div>
| </div>
| </template>
|
|