fix(h5): 小程序 WebView 刘海区背景与顶栏安全区
Logo 下移 safe-area、embed 隐藏 HTML 标题;暖色渐变铺满刘海,页面背景上延与全屏洗底层对齐。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,6 +1,13 @@
|
||||
const MP_EMBED_KEY = 'yxg_mp_embed'
|
||||
const MP_QUERY = 'mp'
|
||||
|
||||
/** Apply document-level embed chrome (safe-area wash, hide HTML title). */
|
||||
export function applyMpEmbedDom(): void {
|
||||
if (typeof document === 'undefined' || !isMpEmbed()) return
|
||||
document.title = '\u200b'
|
||||
document.documentElement.classList.add('mp-embed')
|
||||
}
|
||||
|
||||
/** Persist ?mp=1 from mini-program web-view entry. Call once before router mount. */
|
||||
export function initMpEmbed(): void {
|
||||
if (typeof window === 'undefined') return
|
||||
@@ -8,6 +15,7 @@ export function initMpEmbed(): void {
|
||||
if (params.get(MP_QUERY) === '1') {
|
||||
sessionStorage.setItem(MP_EMBED_KEY, '1')
|
||||
}
|
||||
applyMpEmbedDom()
|
||||
}
|
||||
|
||||
/** True when H5 runs inside WeChat mini-program web-view (no H5 tab bar). */
|
||||
|
||||
Reference in New Issue
Block a user