mirror of
https://github.com/fmhy/edit.git
synced 2026-01-13 07:21:08 +11:00
fix auto theme switch (#4422)
* fix auto theme switch * removed redundant timeout
This commit is contained in:
parent
c11d628228
commit
dcb2f2ffd3
1 changed files with 4 additions and 1 deletions
|
|
@ -68,6 +68,9 @@ export class ThemeHandler {
|
||||||
if (!localStorage.getItem(STORAGE_KEY_MODE)) {
|
if (!localStorage.getItem(STORAGE_KEY_MODE)) {
|
||||||
this.state.value.currentMode = e.matches ? 'dark' : 'light'
|
this.state.value.currentMode = e.matches ? 'dark' : 'light'
|
||||||
this.applyTheme()
|
this.applyTheme()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.applyTheme()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -380,7 +383,7 @@ export function useTheme() {
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
// Ensure theme is applied on mount
|
// Ensure theme is applied on mount
|
||||||
handler.setMode(handler.getMode())
|
handler.applyTheme()
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue