|
|
@@ -0,0 +1,43 @@
|
|
|
+<template>
|
|
|
+ <div id="container" class="map-container"></div>
|
|
|
+</template>
|
|
|
+<script setup>
|
|
|
+import { ref, onMounted } from "vue";
|
|
|
+const map = ref({});
|
|
|
+function initMap() {
|
|
|
+ let longitude = 121.524761;
|
|
|
+ let latitude = 31.228721;
|
|
|
+ map.value = new AMap.Map("container", {
|
|
|
+ zoom: 10, //级别
|
|
|
+ center: [longitude, latitude], //中心点坐标
|
|
|
+ mapStyle: "amap://styles/f48d96805f5fa7f5aada657c5ee37017",
|
|
|
+ zoomEnable: false,
|
|
|
+ dragEnable: false,
|
|
|
+ });
|
|
|
+ let toolBar = new AMap.ToolBar({
|
|
|
+ position: {
|
|
|
+ top: "40px",
|
|
|
+ right: "40px",
|
|
|
+ },
|
|
|
+ });
|
|
|
+ let hawkEye = new AMap.HawkEye({
|
|
|
+ opened: false,
|
|
|
+ });
|
|
|
+ map.value.addControl(toolBar);
|
|
|
+ map.value.addControl(hawkEye);
|
|
|
+}
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ initMap();
|
|
|
+});
|
|
|
+</script>
|
|
|
+<style scoped>
|
|
|
+* {
|
|
|
+ margin: 0;
|
|
|
+ padding: 0;
|
|
|
+}
|
|
|
+#container {
|
|
|
+ width: 100vw;
|
|
|
+ height: 100vh;
|
|
|
+}
|
|
|
+</style>
|