hookehuyr

fix 自动获取地图中心点

<!--
* @Date: 2025-01-22 11:40:12
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2025-02-20 16:10:07
* @LastEditTime: 2025-02-26 09:54:08
* @FilePath: /map-demo/src/views/mapCutter.vue
* @Description: 文件描述
-->
......@@ -117,10 +117,15 @@
<script setup>
import { onMounted, ref, computed, onBeforeUnmount } from "vue";
import { useRoute, useRouter } from 'vue-router'
// import AMapLoader from "@amap/amap-jsapi-loader";
import { TileCutter } from "@/utils/TileCutter";
import { Top, Bottom, Back, Right, Plus, Minus, Brush } from '@element-plus/icons-vue'
import { ElMessage } from 'element-plus'
import { mapAPI } from '@/api/map.js'
const $route = useRoute();
const $router = useRouter();
const map = ref(null);
const imageLayer = ref(null);
......@@ -194,6 +199,10 @@ const handleKeydown = (e) => { // 键盘控制
onMounted(async () => {
loadMap();
window.addEventListener('keydown', handleKeydown)
// 地图中心点
const code = $route.query.id;
const { data } = await mapAPI({ i: code });
map_center.value = data.map.center.map(item => Number(item));
});
onBeforeUnmount(() => {
......