perf(theme): onLaunch 提前设导航栏色,缩小冷启动橙->主题色跳变
新增 applyChrome() 在 onLaunch 第一行调用,把导航栏变色点从首页 onShow 提前到 onLaunch,缩短冷启动橙色跳变窗口。app.json 静态橙色在 JS 执行前 生效是框架硬限制,无法完全消除。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,10 @@ const darkMod = require('./utils/darkMode')
|
||||
|
||||
App({
|
||||
async onLaunch() {
|
||||
// 尽早设导航栏色 + 窗口背景:原生导航栏在 JS 执行前用 app.json 写死的
|
||||
// 橙色,这里在 onLaunch 第一时间切到用户主题色,缩小冷启动跳变窗口。
|
||||
themeMod.applyChrome()
|
||||
|
||||
// Init dark mode listener (refreshes all open pages when system theme changes)
|
||||
darkMod.watchDarkMode((isDark) => {
|
||||
const pages = getCurrentPages()
|
||||
@@ -39,9 +43,6 @@ App({
|
||||
|
||||
this.globalData.theme = themeMod.getCurrentTheme()
|
||||
|
||||
// 窗口背景色 — 冷启动就设好,避免暗黑模式下切 tab 闪白
|
||||
themeMod.applyWindowBg()
|
||||
|
||||
// Sync with cloud: always locate our doc first (pullAll caches
|
||||
// _openid / _docId), then either restore or push. The previous flow
|
||||
// only pulled when local was empty, so on a cold start with non-empty
|
||||
|
||||
Reference in New Issue
Block a user