修复微信内嵌点位搜索导航
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

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