mirror of
https://github.com/fmhy/edit.git
synced 2026-01-13 15:31:07 +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
|
|
@ -21,6 +21,7 @@ import { themeRegistry } from './configs'
|
||||||
const STORAGE_KEY_THEME = 'vitepress-theme-name'
|
const STORAGE_KEY_THEME = 'vitepress-theme-name'
|
||||||
const STORAGE_KEY_MODE = 'vitepress-display-mode'
|
const STORAGE_KEY_MODE = 'vitepress-display-mode'
|
||||||
const STORAGE_KEY_AMOLED = 'vitepress-amoled-enabled'
|
const STORAGE_KEY_AMOLED = 'vitepress-amoled-enabled'
|
||||||
|
const STORAGE_KEY_THEME_DATA = 'vitepress-theme-data'
|
||||||
|
|
||||||
export class ThemeHandler {
|
export class ThemeHandler {
|
||||||
private state = ref<ThemeState>({
|
private state = ref<ThemeState>({
|
||||||
|
|
@ -45,10 +46,6 @@ export class ThemeHandler {
|
||||||
if (themeRegistry[savedTheme]) {
|
if (themeRegistry[savedTheme]) {
|
||||||
this.state.value.currentTheme = savedTheme
|
this.state.value.currentTheme = savedTheme
|
||||||
this.state.value.theme = themeRegistry[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
|
// Set amoled preference
|
||||||
|
|
@ -77,7 +74,7 @@ export class ThemeHandler {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private applyTheme() {
|
public applyTheme() {
|
||||||
if (typeof document === 'undefined') return
|
if (typeof document === 'undefined') return
|
||||||
|
|
||||||
const { currentMode, theme } = this.state.value
|
const { currentMode, theme } = this.state.value
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue