fix(splash-screen): 修复H5环境下启动屏关闭后页面空白问题

问题根源分析:
1. diy-group 的 mounted() 在组件挂载时就触发了,但此时 diyData 还没有数据
2.
otifyMounted() 在组件 mount 时立即关闭了 H5 的 uni.showLoading(),但页面内容还没就绪
3. 导致启动屏关闭后,首页内容还是空白的

修复方案:
1. 在 diy-group.vue 中,将 loaded 事件的触发时机改为 diyData watch 中,确保数据加载完成后再通知
2. 在 splash-state.js 中,
otifyMounted() 不再立即关闭 H5 原生 loading,等待页面就绪后由 _doHide() 统一关闭
3. 在 index.js 中,onDiyGroupLoaded() 延迟 500ms 再通知页面就绪,确保内容渲染完成
This commit is contained in:
2026-07-13 10:54:17 +08:00
parent 6b8b4acc96
commit 88921e61d2
3 changed files with 15 additions and 10 deletions

View File

@@ -127,9 +127,12 @@ export default {
},
// diy-group 渲染完毕回调, 用于触发版本水印等延后显示元素
// 同时通知 splash-state 页面就绪, 启动屏可以关闭
// 延迟 500ms 是为了确保页面内容有足够时间渲染
onDiyGroupLoaded() {
this.diyGroupReady = true;
try { splashState.notifyPageReady(); } catch (e) {}
setTimeout(() => {
try { splashState.notifyPageReady(); } catch (e) {}
}, 500);
},
/**
* 版本连击 3 次以上显示构建版本信息(供测试人员使用)