修复微信内嵌点位搜索导航
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
lyf
2026-07-14 10:19:22 +08:00
parent ef59570b0e
commit 267b415673
4 changed files with 95 additions and 2 deletions

View File

@@ -14,7 +14,7 @@
@mouseup="handlePanelMouseEnd"
@mouseleave="resetPanelMouse"
>
<view v-if="variant === 'home' && showSearchContent" class="home-fullscreen-nav">
<view v-if="showHomeFullscreenNav" class="home-fullscreen-nav">
<view class="home-back-button" data-testid="poi-search-cancel" @tap.stop="handleCancel">
<text class="home-back-icon"></text>
</view>
@@ -245,6 +245,7 @@ import type {
PoiCategoryResultState,
PoiSearchContext
} from '@/domain/poiSearch'
import { isEmbeddedInWechatMiniProgram } from '@/utils/hostEnvironment'
const props = withDefaults(defineProps<{
initialKeyword?: string
@@ -308,6 +309,12 @@ let searchRequestSeq = 0
const collapseDragThreshold = 48
const homeExpandTapGuardMs = 360
const showSearchContent = computed(() => props.variant === 'page' || homeExpanded.value)
const shouldUseHostNavigation = computed(() => isEmbeddedInWechatMiniProgram())
const showHomeFullscreenNav = computed(() => (
props.variant === 'home'
&& showSearchContent.value
&& !shouldUseHostNavigation.value
))
const isHomeCategoryMode = computed(() => (
props.variant === 'home' && homeCategoryMode.value && !homeExpanded.value
))

View File

@@ -715,7 +715,11 @@ const syncTopTabToUrl = (tabId: GuideTopTab) => {
if (typeof window === 'undefined') return
if (!isIndexHashRoute()) return
const url = `#/pages/index/index?tab=${tabId}`
const currentHash = window.location.hash || ''
const queryStart = currentHash.indexOf('?')
const params = new URLSearchParams(queryStart >= 0 ? currentHash.slice(queryStart + 1) : '')
params.set('tab', tabId)
const url = `#/pages/index/index?${params.toString()}`
if (window.location.hash !== url) {
window.history.replaceState(window.history.state, '', url)
}