From f986ff001703aedaa4dada396d6d45d287b1c5b0 Mon Sep 17 00:00:00 2001 From: zsc <957966054@qq.com> Date: Fri, 16 Jan 2026 13:09:58 +0800 Subject: [PATCH] =?UTF-8?q?bugfix-Map=E5=9C=B0=E5=9B=BE=E7=BB=84=E4=BB=B6b?= =?UTF-8?q?ug=E4=BF=AE=E5=A4=8D=201.=20=E9=A6=96=E6=AC=A1=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96center=E5=9D=90=E6=A0=87=E4=B8=8D=E6=B8=B2?= =?UTF-8?q?=E6=9F=93=E9=97=AE=E9=A2=98=202.=20=E5=85=B3=E9=94=AE=E8=AF=8D?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Map/index.vue | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/components/Map/index.vue b/src/components/Map/index.vue index 7b9ae1cf..86010b26 100644 --- a/src/components/Map/index.vue +++ b/src/components/Map/index.vue @@ -71,6 +71,16 @@ const props = defineProps({ center: propTypes.string.def('') }) +watch( + () => props.center, + (newVal, oldVal) => { + if (newVal) { + // 当 center 变化时 重新加载mark点 + regeoCode(newVal) + } + } +) + /** 加载百度地图 */ const loadMap = () => { state.address = '' @@ -101,11 +111,6 @@ const loadMap = () => { regeoCode(state.lonLat) }) } - - // TODO @super:这里加一行注释 - if (props.center) { - regeoCode(props.center) - } } } @@ -155,8 +160,8 @@ const autoSearch = (queryValue: string) => { state.loading = false const temp: any[] = [] - if (results && results.getPoi) { - const pois = results.getPoi() + if (results && results._pois) { + const pois = results._pois pois.forEach((p: any) => { const point = p.point if (point && point.lng && point.lat) {