mirror of
https://github.com/fmhy/edit.git
synced 2026-01-12 23:11:06 +11:00
i saved theme data locally fuck
This commit is contained in:
parent
b41e6b3c9b
commit
aa5eb9c43b
2 changed files with 4 additions and 7 deletions
|
|
@ -260,4 +260,4 @@ const toggleAmoled = () => {
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
|
|
@ -21,6 +21,7 @@ import { themeRegistry } from './configs'
|
|||
const STORAGE_KEY_THEME = 'vitepress-theme-name'
|
||||
const STORAGE_KEY_MODE = 'vitepress-display-mode'
|
||||
const STORAGE_KEY_AMOLED = 'vitepress-amoled-enabled'
|
||||
const STORAGE_KEY_THEME_DATA = 'vitepress-theme-data'
|
||||
|
||||
export class ThemeHandler {
|
||||
private state = ref<ThemeState>({
|
||||
|
|
@ -45,10 +46,6 @@ export class ThemeHandler {
|
|||
if (themeRegistry[savedTheme]) {
|
||||
this.state.value.currentTheme = savedTheme
|
||||
this.state.value.theme = themeRegistry[savedTheme]
|
||||
} else {
|
||||
localStorage.removeItem(STORAGE_KEY_THEME)
|
||||
this.state.value.currentTheme = 'christmas'
|
||||
this.state.value.theme = themeRegistry.christmas
|
||||
}
|
||||
|
||||
// Set amoled preference
|
||||
|
|
@ -77,7 +74,7 @@ export class ThemeHandler {
|
|||
})
|
||||
}
|
||||
|
||||
private applyTheme() {
|
||||
public applyTheme() {
|
||||
if (typeof document === 'undefined') return
|
||||
|
||||
const { currentMode, theme } = this.state.value
|
||||
|
|
@ -393,4 +390,4 @@ export function useTheme() {
|
|||
toggleAmoled: () => handler.toggleAmoled(),
|
||||
state
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue