fix(h5): 小程序 WebView 通过 sbh 参数铺满刘海区
WebView 内 safe-area-inset-top 常为 0,改由小程序传入 statusBarHeight; 全屏洗底层上延并同步原生页背景色,修复刘海露白。
This commit is contained in:
@@ -17,6 +17,13 @@ describe('mpEmbed', () => {
|
||||
expect(isMpEmbed()).toBe(true)
|
||||
})
|
||||
|
||||
it('applies status bar height from ?sbh=', () => {
|
||||
window.history.replaceState({}, '', '/psy/?mp=1&sbh=47')
|
||||
initMpEmbed()
|
||||
expect(document.documentElement.style.getPropertyValue('--yxg-safe-top')).toBe('47px')
|
||||
expect(document.documentElement.style.getPropertyValue('--yxg-page-top')).toBe('calc(47px + 50px)')
|
||||
})
|
||||
|
||||
it('returns false without mp query', () => {
|
||||
initMpEmbed()
|
||||
expect(isMpEmbed()).toBe(false)
|
||||
|
||||
Reference in New Issue
Block a user