From 793b9883766e0e28fd2a1061110c5a4dedeb5249 Mon Sep 17 00:00:00 2001 From: ZF sun <34314687@qq.com> Date: Wed, 15 Jul 2026 15:12:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(splash-screen):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=90=AF=E5=8A=A8=E5=B1=8F=E6=8B=A6=E6=88=AA=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E8=A7=A6=E6=91=B8=E4=BA=8B=E4=BB=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 针对H5端和普通启动场景,分别处理触摸事件拦截问题: 1. 给启动屏组件添加pointer-events:none,让首页在渐隐期也能正常交互 2. 修改uni.showLoading的mask参数为false,避免原生蒙层遮挡触摸 --- common/js/splash-state.js | 6 +++++- components/splash-screen/splash-screen.vue | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/common/js/splash-state.js b/common/js/splash-state.js index b34a6d9..4d3b39c 100644 --- a/common/js/splash-state.js +++ b/common/js/splash-state.js @@ -103,8 +103,12 @@ class SplashState { this._emit('splash:show'); // H5 降级: 走系统 loading (Vue 还没挂载,组件层无法渲染) + // 注意: mask 设为 false。原 mask:true 会在 H5 注入 .uni-mask 全屏透明蒙层, + // 配合 z-index:99999 的 Vue splash 一起把首页触摸全部拦截,导致 H5 + // 首屏在 boot 期间无法滚动。Vue splash 组件本身已带白色背景提供视觉遮罩, + // 这里只要 loading 文字提示,不需要拦截触摸。 if (useNativeLoading()) { - try { uni.showLoading({ title: opts.title || '加载中...', mask: true }); } catch (e) {} + try { uni.showLoading({ title: opts.title || '加载中...', mask: false }); } catch (e) {} } const timeout = opts.timeout || DEFAULT_TIMEOUT; diff --git a/components/splash-screen/splash-screen.vue b/components/splash-screen/splash-screen.vue index d763a8f..d983dc7 100644 --- a/components/splash-screen/splash-screen.vue +++ b/components/splash-screen/splash-screen.vue @@ -112,6 +112,10 @@ overflow: hidden; opacity: 1; transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1); + // 启动屏是纯视觉装饰(轨道/粒子/进度条),无任何可点击元素。 + // 关闭 pointer-events,让首页在 boot 完成前即可滚动/点击, + // 否则 z-index:99999 全屏 fixed 会把触摸事件全部吞掉(含 480ms 渐隐期)。 + pointer-events: none; &--leaving { opacity: 0;