From 58a66d4902c90dabafdddeafd3a92afd36697ef4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Mon, 25 Mar 2019 15:15:40 +0800 Subject: [PATCH] feature: add sidebar logo (#1767) --- src/layout/Layout.vue | 17 +++-- src/layout/components/AppMain.vue | 8 +-- src/layout/components/Navbar.vue | 1 + src/layout/components/Settings/index.vue | 18 +++++- src/layout/components/Sidebar/Logo.vue | 82 ++++++++++++++++++++++++ src/layout/components/Sidebar/index.vue | 35 ++++++---- src/settings.js | 6 ++ src/store/modules/settings.js | 5 +- src/styles/sidebar.scss | 12 ++++ src/styles/transition.scss | 2 +- 10 files changed, 158 insertions(+), 28 deletions(-) create mode 100644 src/layout/components/Sidebar/Logo.vue diff --git a/src/layout/Layout.vue b/src/layout/Layout.vue index a991b771..65abf902 100644 --- a/src/layout/Layout.vue +++ b/src/layout/Layout.vue @@ -66,11 +66,13 @@ export default { position: relative; height: 100%; width: 100%; - &.mobile.openSidebar{ + + &.mobile.openSidebar { position: fixed; top: 0; } } + .drawer-bg { background: #000; opacity: 0.3; @@ -80,18 +82,21 @@ export default { position: absolute; z-index: 999; } - .fixed-header{ + + .fixed-header { position: fixed; top: 0; right: 0; z-index: 9; width: calc(100% - #{$sideBarWidth}); - transition: width 0.28s; + transition: width 0.28s; } - .hideSidebar .fixed-header{ - width: calc(100% - 54px) + + .hideSidebar .fixed-header { + width: calc(100% - 54px) } - .mobile .fixed-header{ + + .mobile .fixed-header { width: 100%; } diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue index f6e1ea10..e8eb633e 100644 --- a/src/layout/components/AppMain.vue +++ b/src/layout/components/AppMain.vue @@ -24,7 +24,7 @@ export default { diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 073fede5..669d8251 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -105,6 +105,7 @@ export default { float: left; cursor: pointer; transition: background .3s; + -webkit-tap-highlight-color:transparent; &:hover { background: rgba(0, 0, 0, .025) diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue index 96e8bb5c..912fb71a 100644 --- a/src/layout/components/Settings/index.vue +++ b/src/layout/components/Settings/index.vue @@ -20,6 +20,11 @@ +
+ 侧边栏 Logo + +
+ @@ -31,7 +36,7 @@ export default { components: { ThemePicker }, data() { return { - sidebarLogo: true + } }, computed: { @@ -56,6 +61,17 @@ export default { value: val }) } + }, + sidebarLogo: { + get() { + return this.$store.state.settings.sidebarLogo + }, + set(val) { + this.$store.dispatch('settings/changeSetting', { + key: 'sidebarLogo', + value: val + }) + } } } } diff --git a/src/layout/components/Sidebar/Logo.vue b/src/layout/components/Sidebar/Logo.vue new file mode 100644 index 00000000..6946149e --- /dev/null +++ b/src/layout/components/Sidebar/Logo.vue @@ -0,0 +1,82 @@ + + + + + diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue index 4c4d6db4..f02a4819 100644 --- a/src/layout/components/Sidebar/index.vue +++ b/src/layout/components/Sidebar/index.vue @@ -1,31 +1,38 @@