Skip to content

Commit 73bf8c0

Browse files
committed
feat: 语言设定改为下拉框选择
1 parent 8a0cb90 commit 73bf8c0

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/components/common/Setting/General.vue

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
<script lang="ts" setup>
22
import { computed, ref } from 'vue'
3-
import { NButton, NInput, NPopconfirm, useMessage } from 'naive-ui'
3+
import { NButton, NInput, NPopconfirm, NSelect, useMessage } from 'naive-ui'
44
import type { Language, Theme } from '@/store/modules/app/helper'
55
import { SvgIcon } from '@/components/common'
66
import { useAppStore, useUserStore } from '@/store'
77
import type { UserInfo } from '@/store/modules/user/helper'
88
import { getCurrentDate } from '@/utils/functions'
9+
import { useBasicLayout } from '@/hooks/useBasicLayout'
910
import { t } from '@/locales'
1011
1112
const appStore = useAppStore()
1213
const userStore = useUserStore()
1314
15+
const { isMobile } = useBasicLayout()
16+
1417
const ms = useMessage()
1518
1619
const theme = computed(() => appStore.theme)
@@ -148,7 +151,10 @@ function handleImportButtonClick(): void {
148151
</NButton>
149152
</div>
150153

151-
<div class="flex items-center space-x-4">
154+
<div
155+
class="flex items-center space-x-4"
156+
:class="isMobile && 'items-start'"
157+
>
152158
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.chatHistory') }}</span>
153159

154160
<div class="flex flex-wrap items-center gap-4">
@@ -199,15 +205,12 @@ function handleImportButtonClick(): void {
199205
<div class="flex items-center space-x-4">
200206
<span class="flex-shrink-0 w-[100px]">{{ $t('setting.language') }}</span>
201207
<div class="flex flex-wrap items-center gap-4">
202-
<template v-for="item of languageOptions" :key="item.key">
203-
<NButton
204-
size="small"
205-
:type="item.key === language ? 'primary' : undefined"
206-
@click="appStore.setLanguage(item.key)"
207-
>
208-
{{ item.label }}
209-
</NButton>
210-
</template>
208+
<NSelect
209+
style="width: 140px"
210+
:value="language"
211+
:options="languageOptions"
212+
@update-value="value => appStore.setLanguage(value)"
213+
/>
211214
</div>
212215
</div>
213216
<div class="flex items-center space-x-4">

0 commit comments

Comments
 (0)