From 359c5515f558db97e18236d669a0b3350dcde1e9 Mon Sep 17 00:00:00 2001 From: ZvonimirSun Date: Fri, 7 Mar 2025 17:30:01 +0800 Subject: [PATCH] =?UTF-8?q?fix(latLng):=20=E4=BF=AE=E5=A4=8D=E7=82=B9?= =?UTF-8?q?=E5=87=BB=E6=8B=BE=E5=8F=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc-auto-import.json | 3 ++- src/tools/latLng.vue | 7 ++++--- src/types/auto-imports.d.ts | 2 ++ src/utils/gisUtils/utils/addressUtils.ts | 1 + 4 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.eslintrc-auto-import.json b/.eslintrc-auto-import.json index d4ec7f5b..c125b779 100644 --- a/.eslintrc-auto-import.json +++ b/.eslintrc-auto-import.json @@ -336,6 +336,7 @@ "onElementRemoval": true, "usePreferredReducedTransparency": true, "useSSRWidth": true, - "useCountdown": true + "useCountdown": true, + "createRef": true } } diff --git a/src/tools/latLng.vue b/src/tools/latLng.vue index d88e0f7d..5b938c6b 100644 --- a/src/tools/latLng.vue +++ b/src/tools/latLng.vue @@ -41,12 +41,12 @@ onMounted(() => { window.requestAnimationFrame(() => { const center = map.getCenter() centerMarker.setLatLng(center) - updatePopupContent(center.wrap(), centerMarker.getPopup()) + updatePopupContent(center, centerMarker.getPopup()) }) }) map.on('click', ({ latlng }: { latlng: LatLng }) => { - latlng = latlng.wrap() - keyword.value = `${latlng.lng},${latlng.lat}` + const wrapLatLng = latlng.wrap() + keyword.value = `${wrapLatLng.lng},${wrapLatLng.lat}` locateLocation(latlng) }) if ('geolocation' in navigator) { @@ -88,6 +88,7 @@ function updatePopupContent(location: LatLng, popup?: Popup, address?: string): closeOnClick: false, }) } + location = location.wrap() const lat = location.lat const lng = location.lng let content = '' diff --git a/src/types/auto-imports.d.ts b/src/types/auto-imports.d.ts index ba30eb9e..403be057 100644 --- a/src/types/auto-imports.d.ts +++ b/src/types/auto-imports.d.ts @@ -25,6 +25,7 @@ declare global { const createInjectionState: typeof import('@vueuse/core')['createInjectionState'] const createPinia: typeof import('pinia')['createPinia'] const createReactiveFn: typeof import('@vueuse/core')['createReactiveFn'] + const createRef: typeof import('@vueuse/core')['createRef'] const createReusableTemplate: typeof import('@vueuse/core')['createReusableTemplate'] const createSharedComposable: typeof import('@vueuse/core')['createSharedComposable'] const createTemplatePromise: typeof import('@vueuse/core')['createTemplatePromise'] @@ -351,6 +352,7 @@ declare module 'vue' { readonly createInjectionState: UnwrapRef readonly createPinia: UnwrapRef readonly createReactiveFn: UnwrapRef + readonly createRef: UnwrapRef readonly createReusableTemplate: UnwrapRef readonly createSharedComposable: UnwrapRef readonly createTemplatePromise: UnwrapRef diff --git a/src/utils/gisUtils/utils/addressUtils.ts b/src/utils/gisUtils/utils/addressUtils.ts index 22f750a0..27bc40f7 100644 --- a/src/utils/gisUtils/utils/addressUtils.ts +++ b/src/utils/gisUtils/utils/addressUtils.ts @@ -28,6 +28,7 @@ export async function getLocation(address: string): Promise<{ } export async function getAddress(location: LatLng): Promise { + location = location.wrap() const gaodeLatLng = csysConvert.gps84_To_gcj02(location.lng, location.lat) const res = await $axios.get(`${config.apiOrigin}/amap/v3/geocode/regeo`, { params: {