forked from eee555/saolei_website
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request eee555#49 from putianyi889/patch-37
增加设置页面,优化菜单外观
- Loading branch information
Showing
11 changed files
with
279 additions
and
181 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,38 @@ | ||
<template> | ||
<el-select v-model="i18n.global.locale.value" style="width: 100px"> | ||
<el-option v-for="item in options" :key="item.lang" :label="item.text" :value="item.lang" /> | ||
</el-select> | ||
<el-dropdown @command="changeLanguage" trigger="click"> | ||
<el-image :src="logo_lang" style="width: 24px; height: 24px; margin-top: 18px; cursor: pointer"></el-image> | ||
<template #dropdown> | ||
<el-dropdown-item v-for="item in options" :command="item.lang"> | ||
{{ item.text }} | ||
</el-dropdown-item> | ||
</template> | ||
</el-dropdown> | ||
</template> | ||
|
||
<script lang="ts" setup name="LanguagePicker"> | ||
import i18n from '@/i18n'; | ||
import { useI18n } from 'vue-i18n'; | ||
import { onBeforeMount } from "vue"; | ||
import i18n from "@/i18n"; | ||
import { useI18n } from "vue-i18n"; | ||
const t = useI18n(); | ||
import { useLocalStore } from "@/store"; | ||
const local = useLocalStore(); | ||
import logo_lang from "@/assets/language.svg"; | ||
const options = [ | ||
{ lang: 'dev', text: 'dev' }, | ||
{ lang: 'zh-cn', text: '简体中文' }, | ||
{ lang: 'de', text: 'name'}, | ||
{ lang: 'en', text: 'English'} | ||
] | ||
{ lang: "zh-cn", text: "简体中文" }, | ||
{ lang: "en", text: "English" }, | ||
{ lang: "de", text: "name" }, | ||
{ lang: "dev", text: "dev" }, | ||
]; | ||
onBeforeMount(() => { | ||
i18n.global.locale.value = local.language; | ||
}); | ||
</script> | ||
const changeLanguage = (value: any) => { | ||
i18n.global.locale.value = value; | ||
local.language = value; | ||
}; | ||
</script> |
Oops, something went wrong.