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 @@