refactor(i18n): 完善remote-only模式下的首屏渲染和请求门控
1. 补充getCachedBundle的注释说明TTL过期缓存返回null 2. 修复globalConfig中onShow的重复判断逻辑,增加boot完成检查 3. 给http请求增加remote-only模式下的boot门控,等待国际化就绪后再发送业务请求 4. 重构main.js的平台差异化处理逻辑,统一各端初始化流程 5. 优化App.vue的boot流程,为小程序/鸿蒙增加加载遮罩 6. 新增bootCompleted状态标志和并发去重机制,完善lang.js的remote-only适配逻辑 7. 补充lang()方法在boot未完成时返回空串的逻辑,避免首屏raw key
This commit is contained in:
@@ -36,6 +36,14 @@ const _callUtil = (vm, method, ...args) => {
|
||||
export default {
|
||||
onLoad() { },
|
||||
onShow() {
|
||||
// remote-only 小程序/鸿蒙: boot 未完成时跳过 refresh,避免空翻译写入标题等
|
||||
// H5 不受影响(main.js 已 await boot 后才 $mount)
|
||||
if (this.$langConfig.isRemoteOnly && this.$langConfig.isRemoteOnly()) {
|
||||
if (!this.$langConfig.isBootCompleted || !this.$langConfig.isBootCompleted()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// 刷新多语言(仅刷新标题,不触发全页面 $forceUpdate)
|
||||
// 全量刷新仅在语言包真正变化时由 lang.js emitUpdated 触发
|
||||
this.$langConfig.refresh(false);
|
||||
|
||||
Reference in New Issue
Block a user