zhanghua
2022-12-13 0dd273d72cf159a47006a63eb8ac85a1c9abea47
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
<template>
    <div id="container"></div>
</template>
<script>
import AMapLoader from "@amap/amap-jsapi-loader";
export default {
    data() {
        return {
            map: null,
        }
    },
    mounted() {
        AMapLoader.load({
            key: "091ade377d4db40f68cc78cb9658ce8d", // 申请好的Web端开发者Key,首次调用 load 时必填
            version: "2.0", // 指定要加载的 JSAPI 的版本,缺省时默认为 1.4.15
            plugins: [], // 需要使用的的插件列表,如比例尺'AMap.Scale'等
        })
            .then((AMap) => {
                this.map = new AMap.Map("container");
                this.map.setZoomAndCenter(15,['119.27179890', '28.59027084']);
            })
            .catch((e) => {
                console.log(e);
            });
    }
}
</script>
<style lang="scss" scoped>
#container {
    width: 100%;
    height: 100%;
}
</style>