perf(暗色): 提交列表、排名首屏卡掉的一秒多回来了 —— 全站共用一个 useDark
VueUse 的 useDark 每个实例挂载时都插一段 style、getComputedStyle 逼整页重算样式, 亮色下它的「没东西要改就跳过」永远不成立。提交列表每行的结果胶囊(useTone)都调它, 一页 30 行就是 30 次整页重算,翻页、换条再来。 改成 shared/composables/dark.ts 的 createGlobalState,auto-import 用 priority 盖掉 @vueuse/core 的同名项,显式 import 的 7 处一并换掉。 生产构建、CPU 降速 6 倍实测:提交列表首屏主线程 2015 → 1092ms(列表出来 1.34 → 0.85 秒), 排名 1950 → 850ms,比赛 1060 → 757ms;右栏换到没看过的一条不再每次卡 100ms。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
55bdf317f1
commit
e511d82f3b
9 files changed
+28
-7
No files matched your search
@@ -1,5 +1,5 @@
|
||||
import { useThemeVars } from 'naive-ui'
|
||||
import { useDark } from '@vueuse/core'
|
||||
import { useDark } from 'shared/composables/dark'
|
||||
|
||||
export type Tone = 'success' | 'error' | 'warning' | 'info' | 'default'
|
||||
|
||||
|
||||
Reference in new issue
Block a user