fix: two clicks are needed to chenge the theme for the first time

This commit is contained in:
Doyoung
2025-10-24 19:01:01 +08:00
parent 2da1af14c5
commit 3d0478f477
2 changed files with 58 additions and 20 deletions

View File

@@ -12,7 +12,7 @@ import {useRuntimeStore} from "@/stores/runtime.ts";
const settingStore = useSettingStore()
const runtimeStore = useRuntimeStore()
const router = useRouter()
const {toggleTheme} = useTheme()
const {toggleTheme,getTheme} = useTheme()
</script>
@@ -58,7 +58,7 @@ const {toggleTheme} = useTheme()
:title="`切换主题(${settingStore.shortcutKeyMap[ShortcutKey.ToggleTheme]})`"
@click="toggleTheme"
>
<IconFluentWeatherMoon16Regular v-if="settingStore.theme === 'light'"/>
<IconFluentWeatherMoon16Regular v-if="getTheme() === 'light'"/>
<IconFluentWeatherSunny16Regular v-else/>
</BaseIcon>
</div>