fix: 适配华为快应用WebView场景并修复tabbar定位问题

1. 新增华为快应用WebView环境检测工具函数
2. 文章组件在快应用WebView中强制关闭滚动模式
3. 修复全局tabbar在H5/快应用中的定位漂移问题,加固fixed定位样式
4. 补全页面配置中的导航栏标题字段
This commit is contained in:
2026-07-15 15:00:42 +08:00
parent b10bf472e3
commit 313c283d9b
6 changed files with 270 additions and 85 deletions

View File

@@ -433,6 +433,20 @@ export function getPlatform() {
return 'quickapp'
}
// #ifdef H5
try {
var ua = navigator?.userAgent;
if (ua) {
// 华为快应用内嵌 WebView 的 UA 关键字:HarmonyQuickApp / HuaweiQuickApp / HQABridge / QuickApp
const isQuickapp = /HarmonyQuickApp|HuaweiQuickApp|HQABridge|QuickApp/i.test(ua);
if (isQuickapp) {
return 'quickapp'
}
}
} catch (e) {}
// #endif
if (typeof process !== 'undefined' && process.env && process.env.UNI_PLATFORM) {
return process.env.UNI_PLATFORM;
}
@@ -454,6 +468,14 @@ export function getPlatform() {
return 'h5';
}
/**
* 判断是否是在华为快应用的WebView中
* @returns
*/
export function isHarmonyQuickAppWebview() {
return getPlatform() === 'quickapp'
}
/**
* 是否需要 JS 侧主动 encodeURIComponent
* 4 平台都需要(true)