From 46561f05a7f77043c50385efb6911bbec7b88a04 Mon Sep 17 00:00:00 2001 From: alwayssuper <191763414@qq.com> Date: Sat, 19 Jul 2025 17:44:48 +0800 Subject: [PATCH] feat:baidumap --- .env | 2 +- src/components/Map/index.vue | 8 ++++++-- src/views/iot/device/device/DeviceForm.vue | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.env b/.env index 741e51ab9..e1024599d 100644 --- a/.env +++ b/.env @@ -24,5 +24,5 @@ VITE_APP_DEFAULT_LOGIN_TENANT = 芋道源码 VITE_APP_DEFAULT_LOGIN_USERNAME = admin VITE_APP_DEFAULT_LOGIN_PASSWORD = admin123 -# 高德地图 +# 百度地图 VITE_BAIDU_MAP_KEY = 'efHIw2qmH8RzHPxK0z0rbCgzDVLup9LD' \ No newline at end of file diff --git a/src/components/Map/index.vue b/src/components/Map/index.vue index fc7287a7c..0386fafd7 100644 --- a/src/components/Map/index.vue +++ b/src/components/Map/index.vue @@ -227,7 +227,11 @@ const regeoCode = (lonLat: string) => { emits('locateChange', lnglat) emits('update:center', lonLat) - // 设置标记并获取地址 + // 先将地图中心点设置到目标位置 + const point = new window.BMapGL.Point(lnglat[0], lnglat[1]) + state.map.centerAndZoom(point, 16) + + // 再设置标记并获取地址 setMarker(lnglat) getAddress(lnglat) } @@ -246,7 +250,7 @@ const getAddress = (lnglat: any) => { }) } -// 显式暴露方法,使其可以被父组件访问 +/** 显式暴露方法,使其可以被父组件访问 */ defineExpose({ regeoCode }) onMounted(() => { diff --git a/src/views/iot/device/device/DeviceForm.vue b/src/views/iot/device/device/DeviceForm.vue index 5eb4b5ffc..ca3584b0e 100644 --- a/src/views/iot/device/device/DeviceForm.vue +++ b/src/views/iot/device/device/DeviceForm.vue @@ -93,14 +93,14 @@ @blur="updateLocationFromCoordinates" /> -
+