Commit 1348de9d authored by tyyin lan's avatar tyyin lan

chore(多语言): 默认语言切换

parent 55d2c127
...@@ -6,7 +6,7 @@ import { Plus } from '@icon-park/vue-next' ...@@ -6,7 +6,7 @@ import { Plus } from '@icon-park/vue-next'
import type { MenuOption } from 'naive-ui' import type { MenuOption } from 'naive-ui'
import CustomIcon from '@/components/custom-icon/custom-icon.vue' import CustomIcon from '@/components/custom-icon/custom-icon.vue'
import { useUserStore } from '@/store/modules/user' import { useUserStore } from '@/store/modules/user'
import LanguageSetting from '@/components/language-setting/language-setting.vue' // import LanguageSetting from '@/components/language-setting/language-setting.vue'
const { t } = useI18n() const { t } = useI18n()
...@@ -117,16 +117,18 @@ function handleMenuValueChange(key: string) { ...@@ -117,16 +117,18 @@ function handleMenuValueChange(key: string) {
</n-scrollbar> </n-scrollbar>
</div> </div>
<div class="mb-[20px] mt-6 px-[12px]"> <div class="mb-[20px] mt-6">
<div> <div>
<NDropdown <NDropdown
v-if="userStore.isLogin" v-if="userStore.isLogin"
trigger="click" trigger="click"
placement="top-start" placement="top"
:options="avatarOptions" :options="avatarOptions"
@select="handleDropdownSelect" @select="handleDropdownSelect"
> >
<div class="flex h-full cursor-pointer items-center"> <div
class="flex h-full cursor-pointer items-center rounded-[6px] px-[12px] py-[4px] transition hover:bg-[#F3F3F5]"
>
<NAvatar round :size="40" object-fit="cover" :src="userStore.userInfo.avatarUrl || defaultAvatar" /> <NAvatar round :size="40" object-fit="cover" :src="userStore.userInfo.avatarUrl || defaultAvatar" />
<div class="ml-3 line-clamp-1 max-w-[140px] select-none break-all text-base"> <div class="ml-3 line-clamp-1 max-w-[140px] select-none break-all text-base">
...@@ -142,9 +144,9 @@ function handleMenuValueChange(key: string) { ...@@ -142,9 +144,9 @@ function handleMenuValueChange(key: string) {
</div> </div>
</div> </div>
<div class="mt-[10px]"> <!-- <div class="mt-[10px]">
<LanguageSetting arrow-direction="top" /> <LanguageSetting arrow-direction="top" />
</div> </div> -->
</div> </div>
</div> </div>
</template> </template>
......
...@@ -3,12 +3,12 @@ import { createI18n } from 'vue-i18n' ...@@ -3,12 +3,12 @@ import { createI18n } from 'vue-i18n'
import messages from './messages' import messages from './messages'
import { ss } from '@/utils/storage' import { ss } from '@/utils/storage'
export const defaultLocale = 'zh-CN' export const defaultLocale = 'zh-HK'
const i18n = createI18n<[I18n.Schema], I18n.LangType>({ const i18n = createI18n<[I18n.Schema], I18n.LangType>({
legacy: false, legacy: false,
locale: ss.get('i18nextLng') || defaultLocale, locale: ss.get('i18nextLng') || defaultLocale,
fallbackLocale: 'zh-HK', fallbackLocale: 'zh-CN',
messages, messages,
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment