From bcee8e4c5e0930837a9a515a8ac23b8007a52fdf Mon Sep 17 00:00:00 2001 From: hooray <304327508@qq.com> Date: Sun, 8 Nov 2020 03:35:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=BB=E5=8A=A8?= =?UTF-8?q?=E7=AB=AF=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/App.vue | 24 ++++++ src/components/FixedActionBar/index.vue | 6 ++ src/layout/components/Breadcrumb/index.vue | 10 ++- src/layout/components/ThemeSetting/index.vue | 26 +++++-- src/layout/components/UserMenu/index.vue | 4 +- src/layout/index.vue | 80 ++++++++++++++++---- src/store/modules/global.js | 9 +++ 7 files changed, 137 insertions(+), 22 deletions(-) diff --git a/src/App.vue b/src/App.vue index 3ce700ec..30157dbc 100644 --- a/src/App.vue +++ b/src/App.vue @@ -20,8 +20,32 @@ export default { $route: 'routeChange', '$store.state.keepAlive.list'(val) { process.env.NODE_ENV == 'development' && console.log(`[ keepAliveList ] ${val}`) + }, + '$store.state.global.mode': { + handler() { + if (this.$store.state.global.mode == 'pc') { + if (this.$store.state.global.enableSidebarCollapse) { + this.$store.commit('global/updateThemeSetting', { + 'sidebarCollapse': false + }) + } + } + if (this.$store.state.global.mode == 'mobile') { + this.$store.commit('global/updateThemeSetting', { + 'sidebarCollapse': true + }) + } + document.body.setAttribute('data-mode', this.$store.state.global.mode) + }, + immediate: true } }, + mounted() { + window.onresize = () => { + this.$store.commit('global/setMode', document.body.clientWidth) + } + window.onresize() + }, methods: { reload(type = 1) { if (type == 1) { diff --git a/src/components/FixedActionBar/index.vue b/src/components/FixedActionBar/index.vue index 76f3b275..bbc780ec 100644 --- a/src/components/FixedActionBar/index.vue +++ b/src/components/FixedActionBar/index.vue @@ -43,6 +43,12 @@ export default {