Skip to content

Commit

Permalink
Merge pull request #23 from libondev/dev-d
Browse files Browse the repository at this point in the history
fix: nav header 语言按钮切换时未存储到本地
  • Loading branch information
libondev authored Apr 10, 2024
2 parents ef6a895 + 9319c33 commit bfcb991
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/components/NavHeader.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<script lang="ts" setup>
import { gameSoundsInjectionKey } from '@/composables/use-game-sounds'
import { i18NInjectionKey } from '@/composables/use-i18n'
import type { Language } from '@/composables/use-local-cache'
import { languages } from '@/config/game'
const {
enableSounds,
toggleSounds,
} = inject(gameSoundsInjectionKey)!
const { lang, $t } = inject(i18NInjectionKey)!
const { lang, setLanguage, $t } = inject(i18NInjectionKey)!
</script>

<template>
Expand All @@ -20,7 +21,7 @@ const { lang, $t } = inject(i18NInjectionKey)!
</h1>

<div class="pt-2 flex items-center gap-2">
<Select v-model="lang" :options="languages" />
<Select v-model="lang" :options="languages" @update:model-value="(e: unknown) => setLanguage(e as Language)" />

<Button @click="toggleSounds()">
<i class="block" :class="enableSounds ? 'i-solar-volume-loud-broken' : 'i-solar-volume-cross-broken text-red-500'" />
Expand Down

0 comments on commit bfcb991

Please sign in to comment.