From 768dacdef7a3291bc23e5cc50125ccc3bdd8dd3d Mon Sep 17 00:00:00 2001 From: chenghongxing <1126263215@qq.com> Date: Sat, 25 Jul 2020 13:20:25 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20state=20of=20min=20page=20height?= =?UTF-8?q?=20in=20setting=20module;=20:star2:=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=EF=BC=9Avuex=20setting=20=E6=A8=A1=E5=9D=97=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=9C=80=E5=B0=8F=E9=AB=98=E5=BA=A6=20state?= =?UTF-8?q?=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layouts/AdminLayout.vue | 16 +++++++------ src/layouts/PageLayout.vue | 38 ++++++++++++++++++++++++++---- src/layouts/header/AdminHeader.vue | 2 +- src/layouts/tabs/TabsView.vue | 14 ++++++++++- src/pages/exception/403.vue | 8 ++----- src/pages/exception/404.vue | 8 +++---- src/pages/exception/500.vue | 8 ++----- src/router/config.js | 11 ++++++--- src/router/index.js | 2 +- src/store/modules/setting.js | 4 ++++ 10 files changed, 77 insertions(+), 34 deletions(-) diff --git a/src/layouts/AdminLayout.vue b/src/layouts/AdminLayout.vue index d9a3fce..932483b 100644 --- a/src/layouts/AdminLayout.vue +++ b/src/layouts/AdminLayout.vue @@ -31,7 +31,7 @@ import PageFooter from './footer/PageFooter' import Drawer from '../components/tool/Drawer' import SideMenu from '../components/menu/SideMenu' import Setting from '../components/setting/Setting' -import {mapState} from 'vuex' +import {mapState, mapMutations} from 'vuex' const minHeight = window.innerHeight - 64 - 24 - 122 @@ -48,13 +48,8 @@ export default { showSetting: false } }, - provide() { - return{ - layoutMinHeight: minHeight - } - }, computed: { - ...mapState('setting', ['isMobile', 'theme', 'layout', 'footerLinks', 'copyright', 'fixedHeader', 'fixedSideBar', 'hideSetting']), + ...mapState('setting', ['isMobile', 'theme', 'layout', 'footerLinks', 'copyright', 'fixedHeader', 'fixedSideBar', 'hideSetting', 'pageMinHeight']), sideMenuWidth() { return this.collapsed ? '80px' : '256px' }, @@ -66,6 +61,7 @@ export default { } }, methods: { + ...mapMutations('setting', ['correctPageMinHeight']), toggleCollapse () { this.collapsed = !this.collapsed }, @@ -73,6 +69,12 @@ export default { this.toggleCollapse() }, }, + created() { + this.correctPageMinHeight(minHeight - 1) + }, + beforeDestroy() { + this.correctPageMinHeight(-minHeight + 1) + }, beforeCreate () { menuData = this.$router.options.routes.find((item) => item.path === '/').children } diff --git a/src/layouts/PageLayout.vue b/src/layouts/PageLayout.vue index 61dc9b4..d429885 100644 --- a/src/layouts/PageLayout.vue +++ b/src/layouts/PageLayout.vue @@ -1,6 +1,6 @@