style: 调整样式

This commit is contained in:
kailong321200875 2024-01-15 13:55:47 +08:00
parent 59d4ed4dd9
commit 09b96c7542
3 changed files with 26 additions and 27 deletions

View File

@ -3,7 +3,6 @@ import { computed } from 'vue'
import { useAppStore } from '@/store/modules/app'
import { ConfigGlobal } from '@/components/ConfigGlobal'
import { useDesign } from '@/hooks/web/useDesign'
import { useDark } from '@vueuse/core'
import { ElNotification } from 'element-plus'
const { getPrefixCls } = useDesign()
@ -16,12 +15,8 @@ const currentSize = computed(() => appStore.getCurrentSize)
const greyMode = computed(() => appStore.getGreyMode)
const isDark = useDark({
valueDark: 'dark',
valueLight: 'light'
})
appStore.initTheme()
isDark.value = appStore.getIsDark
ElNotification({
title: '提示',
type: 'warning',

View File

@ -1,6 +1,6 @@
<script setup lang="ts">
import { ElDrawer, ElDivider, ElMessage } from 'element-plus'
import { ref, unref, computed } from 'vue'
import { ref, unref } from 'vue'
import { useI18n } from '@/hooks/web/useI18n'
import { ThemeSwitch } from '@/components/ThemeSwitch'
import { useCssVar } from '@vueuse/core'
@ -23,8 +23,6 @@ const appStore = useAppStore()
const { t } = useI18n()
const layout = computed(() => appStore.getLayout)
const drawer = ref(false)
//
@ -215,7 +213,6 @@ const themeChange = () => {
/>
<!-- 菜单主题 -->
<template v-if="layout !== 'top'">
<ElDivider>{{ t('setting.menuTheme') }}</ElDivider>
<ColorRadioPicker
v-model="menuTheme"
@ -231,7 +228,6 @@ const themeChange = () => {
]"
@change="setMenuTheme"
/>
</template>
</div>
<!-- 界面显示 -->

View File

@ -5,6 +5,7 @@ import { colorIsDark, hexToRGB, lighten, mix } from '@/utils/color'
import { ElMessage, ComponentSize } from 'element-plus'
import { useCssVar } from '@vueuse/core'
import { unref } from 'vue'
import { useDark } from '@vueuse/core'
interface AppState {
breadcrumb: boolean
@ -59,7 +60,7 @@ export const useAppStore = defineStore('app', {
serverDynamicRouter: true, // 是否服务端渲染动态路由
fixedMenu: false, // 是否固定菜单
layout: 'classic', // layout布局
layout: 'top', // layout布局
isDark: false, // 是否是暗黑模式
currentSize: 'default', // 组件尺寸
theme: {
@ -320,6 +321,13 @@ export const useAppStore = defineStore('app', {
if (this.getLayout === 'top') {
this.setMenuTheme(color)
}
},
initTheme() {
const isDark = useDark({
valueDark: 'dark',
valueLight: 'light'
})
isDark.value = this.getIsDark
}
},
persist: true