feat(privacy): add markSkipped method and H5 skip logic for privacy popup

add markSkipped method to synchronously skip privacy popup, and call it in App.vue created hook for H5 environment when current URL matches skip condition
This commit is contained in:
2026-07-10 14:11:51 +08:00
parent 9d2b76687c
commit e3e63899d8
2 changed files with 22 additions and 0 deletions

10
App.vue
View File

@@ -51,6 +51,16 @@
$langReady: Promise.resolve({ ok: true, source: 'local' })
};
},
// 同步钩子:在 page mounted 之前同步设置隐私弹窗的 skip 状态
// 必须在 onLaunch (async) 之前跑,否则 onLaunch 第一个 await 让出事件循环时
// privacy-popup.vue 已经挂载,会走 consumePendingShow 兜底分支把弹窗弹出来
created() {
// #ifdef H5
if (_shouldSkipPrivacyForCurrentUrl()) {
PrivacyManager.markSkipped()
}
// #endif
},
onLaunch: async function(options) {
// ============================================================
// 主题提前加载(关键):让首屏渲染前 CSS 变量已挂上,避免闪一下