diff --git a/src/config/style.ts b/src/config/style.ts index b652f5a4..63d245e8 100644 --- a/src/config/style.ts +++ b/src/config/style.ts @@ -11,4 +11,5 @@ export default { isUseTabsRouter: false, showHeader: true, brandTheme: '#0052D9', + sideIsDark: 'light', }; diff --git a/src/layouts/components/LayoutSideNav.vue b/src/layouts/components/LayoutSideNav.vue index 112db44e..9dc50a22 100644 --- a/src/layouts/components/LayoutSideNav.vue +++ b/src/layouts/components/LayoutSideNav.vue @@ -5,7 +5,7 @@ :layout="settingStore.layout" :is-fixed="settingStore.isSidebarFixed" :menu="sideMenu" - :theme="settingStore.displayMode" + :theme="settingStore.displaySideMode" :is-compact="settingStore.isSidebarCompact" /> diff --git a/src/layouts/components/SideNav.vue b/src/layouts/components/SideNav.vue index a8b627f9..7e718098 100644 --- a/src/layouts/components/SideNav.vue +++ b/src/layouts/components/SideNav.vue @@ -124,4 +124,14 @@ const getLogo = () => { }; - + diff --git a/src/layouts/setting.vue b/src/layouts/setting.vue index 0d32f4ac..32d552ca 100644 --- a/src/layouts/setting.vue +++ b/src/layouts/setting.vue @@ -62,6 +62,9 @@ + + + diff --git a/src/locales/lang/en_US/layout.ts b/src/locales/lang/en_US/layout.ts index 57681715..b6e4fa66 100644 --- a/src/locales/lang/en_US/layout.ts +++ b/src/locales/lang/en_US/layout.ts @@ -32,6 +32,7 @@ export default { auto: 'Follow System', }, }, + sideIsDark: 'Side Menu Is Dark', navigationLayout: 'Navigation Layout', splitMenu: 'Split Menu(Only Mix mode)', fixedSidebar: 'Fixed Sidebar', diff --git a/src/locales/lang/zh_CN/layout.ts b/src/locales/lang/zh_CN/layout.ts index b648b253..b5dbcf2d 100644 --- a/src/locales/lang/zh_CN/layout.ts +++ b/src/locales/lang/zh_CN/layout.ts @@ -32,6 +32,7 @@ export default { auto: '跟随系统', }, }, + sideIsDark: '侧边栏深色', navigationLayout: '导航布局', splitMenu: '分割菜单(混合模式下有效)', fixedSidebar: '固定侧边栏', diff --git a/src/store/modules/setting.ts b/src/store/modules/setting.ts index 346d4cb4..de45fbe3 100644 --- a/src/store/modules/setting.ts +++ b/src/store/modules/setting.ts @@ -33,6 +33,9 @@ export const useSettingStore = defineStore('setting', { } return state.mode as 'dark' | 'light'; }, + displaySideMode: (state): 'dark' | 'light' => { + return state.sideIsDark as 'dark' | 'light'; + }, }, actions: { async changeMode(mode: 'dark' | 'light' | 'auto') { @@ -71,6 +74,9 @@ export const useSettingStore = defineStore('setting', { insertThemeStylesheet(brandTheme, colorMap, mode as 'light' | 'dark'); document.documentElement.setAttribute('theme-color', brandTheme); }, + changeSideTheme(sideTheme: string) { + this.sideIsDark = sideTheme; + }, updateConfig(payload: Partial) { for (const key in payload) { if (payload[key as TStateKey] !== undefined) { @@ -82,6 +88,9 @@ export const useSettingStore = defineStore('setting', { if (key === 'brandTheme') { this.changeBrandTheme(payload[key]); } + if (key === 'sideIsDark') { + this.changeSideTheme(payload[key]); + } } }, },