feat: 完成主题切换,语言切换的本地存储

This commit is contained in:
MTrun
2021-12-17 11:55:42 +08:00
parent 7f67f482da
commit 557ddd6ee5
27 changed files with 446 additions and 102 deletions
+3
View File
@@ -0,0 +1,3 @@
import LangSelect from './index.vue';
export { LangSelect };
+28
View File
@@ -0,0 +1,28 @@
<template>
<n-dropdown
trigger="hover"
@select="handleSelect"
:show-arrow="true"
:options="options"
>
<n-button quaternary>
<n-icon size="20" :depth="1">
<LanguageIcon />
</n-icon>
</n-button>
</n-dropdown>
</template>
<script lang="ts" setup>
import { useLangStore } from '@/store/modules/langStore/langStore'
import { Language as LanguageIcon } from '@vicons/ionicons5'
import { langList } from '@/settings/designSetting'
import { LangEnum } from '@/enums/styleEnum'
const langStore = useLangStore()
const options = langList
const handleSelect = (key: LangEnum) => {
langStore.changeLang(key)
}
</script>
+6 -8
View File
@@ -1,12 +1,10 @@
<template>
<div>
<n-button quaternary @click="changeTheme">
<n-icon size="20" :depth="1">
<MoonIcon v-if="designStore.darkTheme" />
<SunnyIcon v-else />
</n-icon>
</n-button>
</div>
<n-button quaternary @click="changeTheme">
<n-icon size="20" :depth="1">
<MoonIcon v-if="designStore.darkTheme" />
<SunnyIcon v-else />
</n-icon>
</n-button>
</template>
<script lang="ts" setup>