From c0a369c6d01c2c00d0f9dadd0d909fae95649677 Mon Sep 17 00:00:00 2001 From: lyt <1105290566@qq.com> Date: Tue, 5 Jan 2021 18:11:13 +0800 Subject: [PATCH] =?UTF-8?q?'admin-21.01.05:=E6=96=B0=E5=A2=9Evuex=EF=BC=8C?= =?UTF-8?q?=E7=BC=96=E5=86=99=E5=B8=83=E5=B1=80=E9=85=8D=E7=BD=AE=E7=9B=B8?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E5=8A=9F=E8=83=BD'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue-admin-wonderful-next/package.json | 3 +- vue-admin-wonderful-next/src/main.ts | 3 +- vue-admin-wonderful-next/src/store/index.ts | 48 ++++++- vue-admin-wonderful-next/src/theme/app.scss | 12 +- .../src/utils/themeConfig.ts | 21 +++ .../src/views/layout/component/aside.vue | 10 +- .../src/views/layout/component/main.vue | 31 +++- .../src/views/layout/defaults.vue | 15 +- .../layout/navBars/breadcrumb/breadcrumb.vue | 24 +++- .../layout/navBars/breadcrumb/setings.vue | 136 +++++++++--------- .../src/views/layout/navMenu/vertical.vue | 14 +- 11 files changed, 228 insertions(+), 89 deletions(-) diff --git a/vue-admin-wonderful-next/package.json b/vue-admin-wonderful-next/package.json index 0e5b3db3..347c6938 100644 --- a/vue-admin-wonderful-next/package.json +++ b/vue-admin-wonderful-next/package.json @@ -10,7 +10,8 @@ "mitt": "^2.1.0", "sortablejs": "^1.10.2", "vue": "^3.0.5", - "vue-router": "^4.0.2" + "vue-router": "^4.0.2", + "vuex": "^4.0.0-rc.2" }, "devDependencies": { "@types/sortablejs": "^1.10.6", diff --git a/vue-admin-wonderful-next/src/main.ts b/vue-admin-wonderful-next/src/main.ts index 25e9c42d..b292b341 100644 --- a/vue-admin-wonderful-next/src/main.ts +++ b/vue-admin-wonderful-next/src/main.ts @@ -1,6 +1,7 @@ import { createApp } from 'vue' import App from './App.vue' import router from './router' +import { store, key } from './store' import ElementPlus from 'element-plus' import 'element-plus/lib/theme-chalk/index.css' @@ -9,5 +10,5 @@ import lang from 'element-plus/lib/locale/lang/zh-cn' import mitt from "mitt" const app = createApp(App) -app.use(router).use(ElementPlus, { locale: lang }).mount('#app') +app.use(router).use(store, key).use(ElementPlus, { locale: lang }).mount('#app') app.config.globalProperties.mittBus = mitt() diff --git a/vue-admin-wonderful-next/src/store/index.ts b/vue-admin-wonderful-next/src/store/index.ts index ce37e478..eb116681 100644 --- a/vue-admin-wonderful-next/src/store/index.ts +++ b/vue-admin-wonderful-next/src/store/index.ts @@ -1 +1,47 @@ -const bb: string = '' \ No newline at end of file +import { InjectionKey } from 'vue' +import { createStore, useStore as baseUseStore, Store } from 'vuex' +import themeConfig from '../utils/themeConfig' +export interface RootStateTypes { + themeConfig: { + isDrawer: boolean, + primary: string, + success: string, + info: string, + warning: string, + danger: string, + topBar: string, + menuBar: string, + topBarColor: string, + menuBarColor: string, + isTopBarColorGradual: boolean, + isMenuBarColorGradual: boolean, + isMenuBarColorHighlight: boolean, + isCollapse: boolean, + isUniqueOpened: boolean, + isFixedHeader: boolean, + isCollapse1: boolean, + menuWidth: number, + } +} + +export const key: InjectionKey> = Symbol() + +export const store = createStore({ + state: { + themeConfig + }, + mutations: { + getThemeConfig(state: any, data: object) { + state.themeConfig = Object.assign({}, data) + } + }, + actions: { + setThemeConfig({ commit }, data: object) { + commit('getThemeConfig', data) + } + } +}) + +export function useStore() { + return baseUseStore(key) +} \ No newline at end of file diff --git a/vue-admin-wonderful-next/src/theme/app.scss b/vue-admin-wonderful-next/src/theme/app.scss index bf765ab9..a4953035 100644 --- a/vue-admin-wonderful-next/src/theme/app.scss +++ b/vue-admin-wonderful-next/src/theme/app.scss @@ -41,13 +41,23 @@ body, } .el-main { padding: 0 !important; + } + .el-main-overflow-unset { overflow: unset !important; } + .el-main-overflow-auto { + overflow: auto !important; + } .el-scrollbar { width: 100%; } - .layout-aside-width { + .layout-aside-width240 { width: 240px !important; + transition: width 0.3s ease; + } + .layout-aside-width64 { + width: 64px !important; + transition: width 0.3s ease; } .layout-scrollbar { @extend .el-scrollbar; diff --git a/vue-admin-wonderful-next/src/utils/themeConfig.ts b/vue-admin-wonderful-next/src/utils/themeConfig.ts index e69de29b..b97981c1 100644 --- a/vue-admin-wonderful-next/src/utils/themeConfig.ts +++ b/vue-admin-wonderful-next/src/utils/themeConfig.ts @@ -0,0 +1,21 @@ +// 布局配置 +export default { + isDrawer: false, + primary: "#409eff", + success: "#67c23a", + info: "#909399", + warning: "#e6a23c", + danger: "#f56c6c", + topBar: "#ffffff", + menuBar: "#29384d", + topBarColor: "#606266", + menuBarColor: "#e6e6e6", + isTopBarColorGradual: false, + isMenuBarColorGradual: false, + isMenuBarColorHighlight: false, + isCollapse: false, + isUniqueOpened: false, + isFixedHeader: false, + isCollapse1: false, + menuWidth: 240, +} \ No newline at end of file diff --git a/vue-admin-wonderful-next/src/views/layout/component/aside.vue b/vue-admin-wonderful-next/src/views/layout/component/aside.vue index a1679732..6153db5c 100644 --- a/vue-admin-wonderful-next/src/views/layout/component/aside.vue +++ b/vue-admin-wonderful-next/src/views/layout/component/aside.vue @@ -1,5 +1,5 @@ \ No newline at end of file diff --git a/vue-admin-wonderful-next/src/views/layout/navBars/breadcrumb/breadcrumb.vue b/vue-admin-wonderful-next/src/views/layout/navBars/breadcrumb/breadcrumb.vue index f86a2c7c..cf2923c1 100644 --- a/vue-admin-wonderful-next/src/views/layout/navBars/breadcrumb/breadcrumb.vue +++ b/vue-admin-wonderful-next/src/views/layout/navBars/breadcrumb/breadcrumb.vue @@ -1,6 +1,7 @@