From 3221a4923b1b855db28c3b1678c4e5444431a22c Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Sun, 22 Mar 2020 22:15:28 +0800 Subject: [PATCH] refactor: layout setting drawer. (#113) --- .../SettingDrawer/SettingDrawer.vue | 16 ++++++-------- src/components/Tools/UserMenu.vue | 22 +++++-------------- src/layouts/BasicLayout.vue | 6 ++++- src/store/getters.js | 1 + src/store/modules/app.js | 13 +++++++++-- src/store/mutation-types.js | 1 + 6 files changed, 30 insertions(+), 29 deletions(-) diff --git a/src/components/SettingDrawer/SettingDrawer.vue b/src/components/SettingDrawer/SettingDrawer.vue index c38a496d..42828351 100644 --- a/src/components/SettingDrawer/SettingDrawer.vue +++ b/src/components/SettingDrawer/SettingDrawer.vue @@ -7,7 +7,7 @@ width="300" closable @close="onClose" - :visible="visible" + :visible="layoutSetting" >
@@ -194,6 +194,7 @@ import SettingItem from '@/components/SettingDrawer/SettingItem' import config from '@/config/defaultSettings' import { updateTheme, colorList } from './setting' import { mixin, mixinDevice } from '@/utils/mixin' +import { mapActions, mapGetters } from 'vuex' export default { components: { @@ -202,7 +203,6 @@ export default { mixins: [mixin, mixinDevice], data() { return { - visible: false, colorList, baseConfig: Object.assign({}, config) } @@ -214,15 +214,13 @@ export default { updateTheme(this.primaryColor) } }, + computed: { + ...mapGetters(['layoutSetting']) + }, methods: { - showDrawer() { - this.visible = true - }, + ...mapActions(['setSidebar', 'ToggleLayoutSetting']), onClose() { - this.visible = false - }, - toggle() { - this.visible = !this.visible + this.ToggleLayoutSetting(false) }, handleMenuTheme(theme) { this.baseConfig.navTheme = theme diff --git a/src/components/Tools/UserMenu.vue b/src/components/Tools/UserMenu.vue index ad0c9717..5eed8fe6 100644 --- a/src/components/Tools/UserMenu.vue +++ b/src/components/Tools/UserMenu.vue @@ -15,7 +15,7 @@ -