国际化、主题处理

This commit is contained in:
Gary Fu
2023-12-17 15:11:38 +08:00
parent 99629bc0a5
commit 45ccfddba5
8 changed files with 37 additions and 32 deletions

View File

@@ -1,22 +1,16 @@
<script setup>
import { ref } from 'vue'
import { useDark } from '@vueuse/core'
import { Check } from '@element-plus/icons-vue'
import { useGlobalConfigStore } from '@/stores/globalConfig'
import { useGlobalConfigStore } from '@/stores/globalConfigStore'
const globalConfigStore = useGlobalConfigStore()
const isCollapseLeft = ref(false)
const emit = defineEmits(['update:collapseLeft'])
const updateCollapseLeft = () => {
isCollapseLeft.value = !isCollapseLeft.value
emit('update:collapseLeft', isCollapseLeft.value)
globalConfigStore.collapseLeft()
emit('update:collapseLeft', globalConfigStore.isCollapseLeft)
}
const isDark = useDark()
defineProps({
collapseLeft: {
type: Boolean
@@ -30,10 +24,10 @@ defineProps({
>
<el-menu-item @click="updateCollapseLeft">
<template #title>
<el-icon v-if="!isCollapseLeft">
<el-icon v-if="!globalConfigStore.isCollapseLeft">
<Fold />
</el-icon>
<el-icon v-if="isCollapseLeft">
<el-icon v-if="globalConfigStore.isCollapseLeft">
<Expand />
</el-icon>
<span>&nbsp;</span>
@@ -69,18 +63,18 @@ defineProps({
</template>
<el-menu-item
index="2-1"
@click="isDark=false"
@click="globalConfigStore.changeTheme(false)"
>
<el-icon v-if="!isDark">
<el-icon v-if="!globalConfigStore.isDarkTheme">
<Check />
</el-icon>
{{ $t('common.label.themeDefault') }}
</el-menu-item>
<el-menu-item
index="2-2"
@click="isDark=true"
@click="globalConfigStore.changeTheme(true)"
>
<el-icon v-if="isDark">
<el-icon v-if="globalConfigStore.isDarkTheme">
<Check />
</el-icon>
{{ $t('common.label.themeDark') }}