From a042a94346e032088242d7b0083c82c54703997f Mon Sep 17 00:00:00 2001 From: toesbieya <1647775459@qq.com> Date: Wed, 25 Nov 2020 17:23:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=A7=E8=BE=B9=E6=A0=8F=E5=92=8C=E5=AF=BC?= =?UTF-8?q?=E8=88=AA=E6=A0=8F=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=B8=BB=E9=A2=98?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复了导航栏自适应时节点未更新的问题 修复了SettingDrawer由于layout设置变化而重新渲染的问题 导航菜单在没有icon时不会再渲染占位元素 ContextMenu表现形式修改: - 使用v-show代替整个dom的移除 - 定位由absolute改为fixed 代码优化 --- vue/src/asset/icon/svg/develop.svg | 1 + vue/src/asset/style/element-ui.scss | 16 +- vue/src/asset/style/variables.scss | 39 +-- vue/src/component/menu/ContextMenu/index.vue | 8 +- vue/src/component/menu/NavMenu/index.vue | 30 ++- vue/src/component/menu/NavMenu/item.vue | 55 ++-- vue/src/component/menu/NavMenu/style.scss | 156 +++++------- .../component/menu/NavMenu/theme-dark.scss | 61 +++++ .../component/menu/NavMenu/theme-light.scss | 39 +++ .../layout/component/Aside/TwoPart/index.vue | 17 -- .../index.vue => component/OnePartRoot.vue} | 53 ++-- .../root.vue => component/TwoPartRoot.vue} | 57 +---- .../sub.vue => component/TwoPartSub.vue} | 44 +--- vue/src/layout/component/Aside/index.vue | 52 ++-- vue/src/layout/component/Aside/style.scss | 89 +++++++ .../layout/component/Aside/theme-dark.scss | 18 ++ .../layout/component/Aside/theme-light.scss | 6 + vue/src/layout/component/Logo.vue | 12 +- .../component/Navbar/component/Bell.vue | 1 + .../component/Navbar/component/HeadMenu.vue | 80 +++--- vue/src/layout/component/Navbar/index.vue | 241 +++++++----------- vue/src/layout/component/Navbar/style.scss | 49 ++++ .../layout/component/Navbar/theme-dark.scss | 11 + .../layout/component/Navbar/theme-light.scss | 11 + .../Page/component/TagsView/index.vue | 46 ++-- .../Page/component/TagsView/style.scss | 23 +- vue/src/layout/component/Page/index.vue | 3 +- vue/src/layout/component/SettingDrawer.vue | 99 ++++--- vue/src/layout/index.vue | 30 ++- vue/src/layout/store/app.js | 4 + vue/src/layout/store/aside.js | 3 + vue/src/layout/store/navbar.js | 13 + vue/src/router/module/devRoot/index.js | 2 +- vue/src/util/browser.js | 6 +- vue/src/view/app/common/DetailPage/style.scss | 2 +- vue/src/view/example/cool/fluidPage.vue | 2 +- .../component/PanelGroup/PanelGroupItem.vue | 1 - .../view/index/component/PanelGroup/index.vue | 10 +- .../view/system/category/component/List.vue | 8 +- vue/src/view/system/department/indexPage.vue | 5 +- 40 files changed, 793 insertions(+), 610 deletions(-) create mode 100644 vue/src/asset/icon/svg/develop.svg create mode 100644 vue/src/component/menu/NavMenu/theme-dark.scss create mode 100644 vue/src/component/menu/NavMenu/theme-light.scss delete mode 100644 vue/src/layout/component/Aside/TwoPart/index.vue rename vue/src/layout/component/Aside/{OnePart/index.vue => component/OnePartRoot.vue} (88%) rename vue/src/layout/component/Aside/{TwoPart/root.vue => component/TwoPartRoot.vue} (76%) rename vue/src/layout/component/Aside/{TwoPart/sub.vue => component/TwoPartSub.vue} (78%) create mode 100644 vue/src/layout/component/Aside/style.scss create mode 100644 vue/src/layout/component/Aside/theme-dark.scss create mode 100644 vue/src/layout/component/Aside/theme-light.scss create mode 100644 vue/src/layout/component/Navbar/style.scss create mode 100644 vue/src/layout/component/Navbar/theme-dark.scss create mode 100644 vue/src/layout/component/Navbar/theme-light.scss create mode 100644 vue/src/layout/store/navbar.js diff --git a/vue/src/asset/icon/svg/develop.svg b/vue/src/asset/icon/svg/develop.svg new file mode 100644 index 0000000..a0dadbd --- /dev/null +++ b/vue/src/asset/icon/svg/develop.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/vue/src/asset/style/element-ui.scss b/vue/src/asset/style/element-ui.scss index 5ed8bfa..fba9c17 100644 --- a/vue/src/asset/style/element-ui.scss +++ b/vue/src/asset/style/element-ui.scss @@ -94,9 +94,10 @@ } .el-menu { - border: none; height: 100%; width: 100%; + border: none !important; + overflow: hidden; &::-webkit-scrollbar { display: none; @@ -125,6 +126,11 @@ color: inherit; } + //原先垂直时右侧展开箭头偏上 + .el-submenu__icon-arrow { + margin-top: -4px; + } + //弹出菜单 &.el-menu--popup { max-height: 88vh; @@ -138,6 +144,14 @@ padding: 0 20px; } } + + &--horizontal > .el-menu-item:not(.is-disabled):hover, + &--horizontal > .el-menu-item:not(.is-disabled):focus, + &--horizontal > .el-submenu .el-submenu__title:hover, + &--horizontal .el-menu .el-menu-item, + &--horizontal .el-menu .el-submenu__title { + background-color: inherit; + } } .el-message { diff --git a/vue/src/asset/style/variables.scss b/vue/src/asset/style/variables.scss index 2f0bbc5..0e8de92 100644 --- a/vue/src/asset/style/variables.scss +++ b/vue/src/asset/style/variables.scss @@ -1,4 +1,4 @@ -//设定移动端的最大宽度 +//设定移动端的最大宽度,只能是number类型 $max-mobile-width: 500px; //覆盖element颜色 @@ -47,29 +47,33 @@ $--font-path: '~element-ui/lib/theme-chalk/fonts'; } } +//菜单中icon的大小 +$menu-icon-size: 16px; //菜单中icon和文字的距离 $menu-icon-text-gap: 10px; - -//侧边菜单icon的大小 -$aside-icon-size: 16px; -//侧边栏菜单的背景色 -$aside-menu-background: #304156; -//侧边栏子菜单的背景色 -$aside-sub-menu-background: #1f2d3d; -//侧边栏菜单文字的颜色 -$aside-menu-item-color: hsla(0, 0%, 99.6%, .65); -//侧边栏菜单文字的hover颜色 -$aside-menu-item-hover-color: #fefefe; - -//顶部菜单文字的颜色 -$head-menu-item-color: #303133; -//顶部菜单文字的hover颜色 -$head-menu-item-hover-color: $--color-primary; +//暗色菜单的背景色 +$menu-dark-background: #304156; +//暗色子级菜单的背景色 +$sub-menu-dark-background: #1f2d3d; +//暗色主菜单的背景色(用于双层侧边栏的主菜单和顶部导航栏) +$root-menu-dark-background: #001529; +//亮色菜单的文字颜色 +$menu-text-light-color: #303133; +//亮色菜单的文字hover颜色 +$menu-text-hover-light-color: $--color-primary; +//暗色菜单的文字颜色 +$menu-text-dark-color: rgba(255, 255, 255, .65); +//暗色菜单的文字hover颜色 +$menu-text-dark-hover-color: rgba(255, 255, 255, 1); //侧边栏宽度 $aside-width: 208px; +//侧边栏折叠时的宽度 +$aside-collapse-width: $menu-icon-size + 20px * 2; + //头部导航栏高度 $nav-height: 48px; + //头部多页签栏高度 $tags-view-height: 32px; @@ -86,6 +90,7 @@ $dialog-top: 100px; // the :export directive is the magic sauce for webpack // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass :export { + maxMobileWidth: $max-mobile-width; primary: $--color-primary; info: $--color-info; success: $--color-success; diff --git a/vue/src/component/menu/ContextMenu/index.vue b/vue/src/component/menu/ContextMenu/index.vue index cba7dd6..3bf2428 100644 --- a/vue/src/component/menu/ContextMenu/index.vue +++ b/vue/src/component/menu/ContextMenu/index.vue @@ -70,12 +70,12 @@ export default { }, render() { - if (!this.value || !Array.isArray(this.items) || this.items.length === 0) return + if (!Array.isArray(this.items)) return const style = {left: this.realLeft, top: this.realTop} return ( -