From 3f3acf834d79aaf6ae5fdab59a6f9f16016b9e3b Mon Sep 17 00:00:00 2001 From: shiran <2488252513@qq.com> Date: Sat, 9 May 2026 18:49:42 +0800 Subject: [PATCH] =?UTF-8?q?feat(map):=20=E6=B7=BB=E5=8A=A0=E5=9C=B0?= =?UTF-8?q?=E5=9B=BE=E5=AE=9A=E4=BD=8D=E5=8A=9F=E8=83=BD=E7=9A=84=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6=E6=B8=B2=E6=9F=93=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 为了解决H5平台地图定位显示的问题,在index页面和pick-location页面中添加了 mapShowLocation响应式变量,并通过条件编译确保仅在非H5平台启用地图定位功能, 避免H5环境下出现定位相关的兼容性问题。 --- clients/pages/index/index.vue | 7 ++++++- clients/pages/spot/pick-location.vue | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/clients/pages/index/index.vue b/clients/pages/index/index.vue index 86338f1..8996cfd 100644 --- a/clients/pages/index/index.vue +++ b/clients/pages/index/index.vue @@ -48,6 +48,11 @@ const selectedSpot = ref(null); const locating = ref(false); const mapCtx = ref(null); const userLocation = ref(null); +const mapShowLocation = ref(false); + +// #ifndef H5 +mapShowLocation.value = true; +// #endif const truncate = (str, len = 8) => str && str.length > len ? str.slice(0, len) + "…" : str; @@ -390,7 +395,7 @@ onMounted(() => { :longitude="mapCenter.longitude" :markers="markers" :scale="12" - :show-location="true" + :show-location="mapShowLocation" :enable-zoom="true" :enable-scroll="true" @markertap="onMarkerTap" diff --git a/clients/pages/spot/pick-location.vue b/clients/pages/spot/pick-location.vue index 21841c6..92e944c 100644 --- a/clients/pages/spot/pick-location.vue +++ b/clients/pages/spot/pick-location.vue @@ -7,6 +7,11 @@ const longitude = ref(116.39747); const address = ref("移动地图选择位置"); const currentCity = ref(""); const mapCtx = ref(null); +const mapShowLocation = ref(false); + +// #ifndef H5 +mapShowLocation.value = true; +// #endif const keyword = ref(""); const searchResults = ref([]); @@ -129,7 +134,7 @@ const confirmLocation = () => { :latitude="latitude" :longitude="longitude" :scale="16" - show-location + :show-location="mapShowLocation" @regionchange="onRegionChange" />