完善搜索点位分类与稳定定位
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-12 04:10:34 +08:00
parent d8420fc7c2
commit f94af2de4d
5 changed files with 188 additions and 37 deletions

View File

@@ -296,7 +296,7 @@ const floorLoadError = ref('')
const excludedPoiCount = ref(0)
const duplicatePoiCount = ref(0)
const resultListScrollTop = ref(0)
const resultListRef = ref<HTMLElement | null>(null)
const resultListRef = ref<HTMLElement | { $el?: HTMLElement } | null>(null)
let cachedPoiPool: PreparedPoiResults | null = null
let searchRequestSeq = 0
@@ -807,8 +807,15 @@ const handleResultListScroll = (event: any) => {
resultListScrollTop.value = Number.isFinite(scrollTop) ? Math.max(0, scrollTop) : 0
}
const getResultListElement = (): HTMLElement | null => {
const target = resultListRef.value
if (!target) return null
if ('$el' in target) return target.$el || null
return target as HTMLElement
}
const captureResultListScroll = () => {
const scrollTop = Number(resultListRef.value?.scrollTop)
const scrollTop = Number(getResultListElement()?.scrollTop)
if (Number.isFinite(scrollTop)) resultListScrollTop.value = Math.max(0, scrollTop)
}
@@ -817,7 +824,8 @@ const restoreResultListScroll = async () => {
if (scrollTop <= 0) return
await nextTick()
if (resultListRef.value) resultListRef.value.scrollTop = scrollTop
const resultListElement = getResultListElement()
if (resultListElement) resultListElement.scrollTop = scrollTop
}
const poiDisplayName = (poi: MuseumPoi) => poi.name?.trim() || '未命名点位'