bugfix-Map地图组件bug修复

1. 首次初始化center坐标不渲染问题
2. 关键词搜索失败问题
pull/852/head
zsc 2026-01-16 13:09:58 +08:00
parent 5d7cb9332c
commit f986ff0017
1 changed files with 12 additions and 7 deletions

View File

@ -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) {