feat(map): 添加地图定位功能的条件渲染控制

为了解决H5平台地图定位显示的问题,在index页面和pick-location页面中添加了
mapShowLocation响应式变量,并通过条件编译确保仅在非H5平台启用地图定位功能,
避免H5环境下出现定位相关的兼容性问题。
This commit is contained in:
2026-05-09 18:49:42 +08:00
parent a493d1bcf6
commit 3f3acf834d
2 changed files with 12 additions and 2 deletions
+6 -1
View File
@@ -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"