From 663738262dedeef1161daf551f35e59b0abc0f14 Mon Sep 17 00:00:00 2001 From: Pan Date: Wed, 10 Oct 2018 14:18:43 +0800 Subject: [PATCH] add tagsView option --- src/settings.js | 16 +++++++++++----- src/store/modules/app.js | 10 +++++++++- src/views/layout/Layout.vue | 7 +++++-- src/views/layout/components/AppMain.vue | 21 ++++++++++++++------- src/views/layout/components/Navbar.vue | 6 ++++++ 5 files changed, 45 insertions(+), 15 deletions(-) diff --git a/src/settings.js b/src/settings.js index ea5b130b..b6ffcc08 100644 --- a/src/settings.js +++ b/src/settings.js @@ -1,27 +1,33 @@ export default { /** - * @property {string} en | zh + * @type {string} en | zh * @description User first visited, default language */ language: 'en', /** - * @property {string} medium | small | mini + * @type {string} medium | small | mini * @description User first visited, default size */ size: 'medium', /** - * @property {string} hash | history + * @type {string} hash | history * @description vue-router mode */ routerMode: 'hash', /** - * @property {string} fade-transform | fade + * @type {string} fade-transform | fade * @description Page transition animation */ - viewsTransition: 'fade-transform' + viewsTransition: 'fade-transform', + + /** + * @type {boolean} true | false + * @description Need tagsView + */ + tagsView: true // permission: true, // i18n: true diff --git a/src/store/modules/app.js b/src/store/modules/app.js index 9f8b2fd4..9da5cf5f 100644 --- a/src/store/modules/app.js +++ b/src/store/modules/app.js @@ -10,7 +10,8 @@ const app = { device: 'desktop', language: Cookies.get('language') || settings.language, size: Cookies.get('size') || settings.size, - viewsTransition: Cookies.get('viewsTransition') || settings.viewsTransition + viewsTransition: Cookies.get('viewsTransition') || settings.viewsTransition, + needTagsView: Cookies.get('needTagsView') || settings.tagsView }, mutations: { TOGGLE_SIDEBAR: state => { @@ -41,6 +42,10 @@ const app = { SET_VIEWS_TRANSITION: (state, viewsTransition) => { state.viewsTransition = viewsTransition Cookies.set('viewsTransition', viewsTransition) + }, + SET_TAGS_VIEW: (state, needTagsView) => { + state.needTagsView = needTagsView + Cookies.set('needTagsView', needTagsView) } }, actions: { @@ -61,6 +66,9 @@ const app = { }, setViewsTransition({ commit }, viewsTransition) { commit('SET_VIEWS_TRANSITION', viewsTransition) + }, + setTagsView({ commit }, needTagsView) { + commit('SET_TAGS_VIEW', needTagsView) } } } diff --git a/src/views/layout/Layout.vue b/src/views/layout/Layout.vue index bd882ef0..2415e2f0 100644 --- a/src/views/layout/Layout.vue +++ b/src/views/layout/Layout.vue @@ -2,9 +2,9 @@
-
+
- +
@@ -37,6 +37,9 @@ export default { withoutAnimation: this.sidebar.withoutAnimation, mobile: this.device === 'mobile' } + }, + needTagsView() { + return this.$store.state.app.needTagsView } }, methods: { diff --git a/src/views/layout/components/AppMain.vue b/src/views/layout/components/AppMain.vue index f22f8356..c8e2dc7c 100644 --- a/src/views/layout/components/AppMain.vue +++ b/src/views/layout/components/AppMain.vue @@ -26,12 +26,19 @@ export default { diff --git a/src/views/layout/components/Navbar.vue b/src/views/layout/components/Navbar.vue index 7bae38e0..4ac28e50 100644 --- a/src/views/layout/components/Navbar.vue +++ b/src/views/layout/components/Navbar.vue @@ -90,10 +90,16 @@ export default {