File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 55 < link rel ="icon " type ="image/svg+xml " href ="/icon.svg " />
66 < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
77 < title > 私人导航</ title >
8+
9+ <!-- 🚀 主题初始化脚本:避免白屏闪烁 -->
10+ < script >
11+ ( function ( ) {
12+ try {
13+ // 从 localStorage 拿 Pinia 持久化的 theme store
14+ const store = localStorage . getItem ( 'theme' )
15+ let mode = 'system'
16+ if ( store ) {
17+ mode = JSON . parse ( store ) . mode || 'system'
18+ }
19+
20+ const systemDark = window . matchMedia ( '(prefers-color-scheme: dark)' ) . matches
21+ const isDark = mode === 'dark' || ( mode === 'system' && systemDark )
22+
23+ if ( isDark ) {
24+ document . documentElement . classList . add ( 'dark' )
25+ } else {
26+ document . documentElement . classList . remove ( 'dark' )
27+ }
28+ } catch ( e ) {
29+ console . error ( 'theme init error' , e )
30+ }
31+ } ) ( )
32+ </ script >
833 </ head >
934 < body >
1035 < div id ="app "> </ div >
You can’t perform that action at this time.
0 commit comments