From d919acf64b3410a33c69ae214c8ab05b5b8b5459 Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 21 Mar 2019 16:38:41 +0800 Subject: [PATCH] feature: add fixedHeader settings --- src/components/RightPanel/index.vue | 97 ++++++++++++------------ src/layout/Layout.vue | 22 +++++- src/layout/components/AppMain.vue | 18 ++++- src/layout/components/Navbar.vue | 2 + src/layout/components/Settings/index.vue | 21 ++++- src/settings.js | 6 ++ src/store/modules/settings.js | 5 +- 7 files changed, 113 insertions(+), 58 deletions(-) diff --git a/src/components/RightPanel/index.vue b/src/components/RightPanel/index.vue index 9fe43f89..fb356c39 100644 --- a/src/components/RightPanel/index.vue +++ b/src/components/RightPanel/index.vue @@ -74,57 +74,60 @@ export default { diff --git a/src/layout/Layout.vue b/src/layout/Layout.vue index aab2df58..4691e277 100644 --- a/src/layout/Layout.vue +++ b/src/layout/Layout.vue @@ -3,8 +3,10 @@
- - +
+ + +
@@ -35,7 +37,8 @@ export default { sidebar: state => state.app.sidebar, device: state => state.app.device, showSettings: state => state.settings.showSettings, - needTagsView: state => state.settings.tagsView + needTagsView: state => state.settings.tagsView, + fixedHeader: state => state.settings.fixedHeader }), classObj() { return { @@ -56,6 +59,8 @@ export default { diff --git a/src/layout/components/AppMain.vue b/src/layout/components/AppMain.vue index b7956f0c..f6e1ea10 100644 --- a/src/layout/components/AppMain.vue +++ b/src/layout/components/AppMain.vue @@ -22,7 +22,7 @@ export default { } - diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index e2829001..073fede5 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -95,6 +95,8 @@ export default { .navbar { height: 50px; overflow: hidden; + position: relative; + background: #fff; box-shadow: 0 1px 4px rgba(0,21,41,.08); .hamburger-container { diff --git a/src/layout/components/Settings/index.vue b/src/layout/components/Settings/index.vue index 6c171b30..96e8bb5c 100644 --- a/src/layout/components/Settings/index.vue +++ b/src/layout/components/Settings/index.vue @@ -5,15 +5,21 @@ 系统布局配置 +
+ 主题色 + +
+
开启 Tags-View
- 主题色 - + 固定 Header +
+
@@ -29,6 +35,17 @@ export default { } }, computed: { + fixedHeader: { + get() { + return this.$store.state.settings.fixedHeader + }, + set(val) { + this.$store.dispatch('settings/changeSetting', { + key: 'fixedHeader', + value: val + }) + } + }, tagsView: { get() { return this.$store.state.settings.tagsView diff --git a/src/settings.js b/src/settings.js index 7e3e133d..4b1a57d3 100644 --- a/src/settings.js +++ b/src/settings.js @@ -13,6 +13,12 @@ export default { */ tagsView: true, + /** + * @type {boolean} true | false + * @description Whether fix the header + */ + fixedHeader: true, + /** * @type {string | array} 'production' | ['production','development'] * @description Need show err logs component. diff --git a/src/store/modules/settings.js b/src/store/modules/settings.js index eb84a7aa..b17b987f 100644 --- a/src/store/modules/settings.js +++ b/src/store/modules/settings.js @@ -1,9 +1,10 @@ import defaultSettings from '@/settings' -const { showSettings, tagsView } = defaultSettings +const { showSettings, tagsView, fixedHeader } = defaultSettings const state = { showSettings: showSettings, - tagsView: tagsView + tagsView: tagsView, + fixedHeader: fixedHeader } const mutations = {