fix(h5): 修复 WebView 顶栏 logo 与内容重叠

embed 模式 header 改文档流、移除负 margin;持久化 sbh 并在路由中保留,避免胶囊区与档案条重叠。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-25 01:22:39 +08:00
co-authored by Cursor
parent 9d4fb52d29
commit f4bd57ce1b
7 changed files with 48 additions and 14 deletions
+14 -2
View File
@@ -50,8 +50,20 @@ const router = createRouter({
})
router.beforeEach((to) => {
if (!isMpEmbed() || to.query.mp === '1') return true
return { path: to.path, query: { ...to.query, mp: '1' }, hash: to.hash, replace: true }
if (!isMpEmbed()) return true
const q = { ...to.query }
let changed = false
if (q.mp !== '1') {
q.mp = '1'
changed = true
}
const storedSbh = sessionStorage.getItem('yxg_sbh')
if (storedSbh && q.sbh !== storedSbh) {
q.sbh = storedSbh
changed = true
}
if (!changed) return true
return { path: to.path, query: q, hash: to.hash, replace: true }
})
export default router