|
@@ -876,7 +876,26 @@ var utils = {
|
|
|
}
|
|
|
}
|
|
|
return appTabbarName
|
|
|
- }
|
|
|
+ },
|
|
|
+ // 部分h5浏览器(华为、荣耀)页面返回不刷新兼容
|
|
|
+ fixSomeH5BackRefresh () {
|
|
|
+ // 如果全局有,则说明已经被调用过,就不需要再次调用
|
|
|
+ if (window.fixSomeH5BackRefresh && typeof window.fixSomeH5BackRefresh) return
|
|
|
+ if (utilsEnv.platformEnvs.platform !== 'h5') return
|
|
|
+ const ua = navigator.userAgent.toLowerCase()
|
|
|
+ // 判断是不是华为/荣耀浏览器
|
|
|
+ const huawei = ua.includes('huawei') || ua.includes('honor')
|
|
|
+ if (huawei) {
|
|
|
+ window.addEventListener('visibilitychange', function () {
|
|
|
+ const v = document.visibilityState
|
|
|
+ if (v === 'hidden') {
|
|
|
+ // do something
|
|
|
+ } else if (v === 'visible') {
|
|
|
+ location.reload()
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
}
|
|
|
Object.defineProperty(utils.$env, 'appVersion', {
|
|
|
get () {
|
|
@@ -889,3 +908,4 @@ Object.defineProperty(utils.$env, 'appVersion', {
|
|
|
return version
|
|
|
}
|
|
|
})
|
|
|
+utils.fixSomeH5BackRefresh()
|