From 83576d88d7f3203410335eb13037eeb2e25d0a68 Mon Sep 17 00:00:00 2001 From: chenghongxing <1126263215@qq.com> Date: Wed, 30 Sep 2020 16:38:37 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20add=20function=20of=20fixing=20the=20he?= =?UTF-8?q?ad=20of=20tabs;=20:star:=20=E6=96=B0=E5=A2=9E=EF=BC=9A=E5=9B=BA?= =?UTF-8?q?=E5=AE=9A=E9=A1=B5=E7=AD=BE=E5=A4=B4=E5=8A=9F=E8=83=BD=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/config/default/setting.config.js | 1 + src/layouts/AdminLayout.vue | 26 ++++- src/layouts/tabs/TabsHead.vue | 155 +++++++++++++++++++++++++++ src/layouts/tabs/TabsView.vue | 25 ++--- src/store/modules/setting.js | 3 + 5 files changed, 190 insertions(+), 20 deletions(-) create mode 100644 src/layouts/tabs/TabsHead.vue diff --git a/src/config/default/setting.config.js b/src/config/default/setting.config.js index b2ef5a7..361f158 100644 --- a/src/config/default/setting.config.js +++ b/src/config/default/setting.config.js @@ -11,6 +11,7 @@ module.exports = { layout: 'side', //导航布局,可选 side 和 head,分别为侧边导航和顶部导航 fixedHeader: false, //固定头部状态栏,true:固定,false:不固定 fixedSideBar: true, //固定侧边栏,true:固定,false:不固定 + fixedTabs: false, //固定页签头,true:固定,false:不固定 pageWidth: 'fixed', //内容区域宽度,fixed:固定宽度,fluid:流式宽度 weekMode: false, //色弱模式,true:开启,false:不开启 multiPage: false, //多页签模式,true:开启,false:不开启 diff --git a/src/layouts/AdminLayout.vue b/src/layouts/AdminLayout.vue index 2cee78f..ab684b5 100644 --- a/src/layouts/AdminLayout.vue +++ b/src/layouts/AdminLayout.vue @@ -12,8 +12,8 @@ - - + +
@@ -47,6 +47,11 @@ export default { drawerOpen: false } }, + provide() { + return { + adminLayout: this + } + }, watch: { $route(val) { this.setActivated(val) @@ -62,7 +67,7 @@ export default { }, computed: { ...mapState('setting', ['isMobile', 'theme', 'layout', 'footerLinks', 'copyright', 'fixedHeader', 'fixedSideBar', - 'hideSetting']), + 'fixedTabs', 'hideSetting', 'multiPage']), ...mapGetters('setting', ['firstMenu', 'subMenu', 'menuData']), sideMenuWidth() { return this.collapsed ? '80px' : '256px' @@ -70,8 +75,7 @@ export default { headerStyle() { let width = (this.fixedHeader && this.layout !== 'head' && !this.isMobile) ? `calc(100% - ${this.sideMenuWidth})` : '100%' let position = this.fixedHeader ? 'fixed' : 'static' - let transition = this.fixedHeader ? 'transition: width 0.2s' : '' - return `width: ${width}; position: ${position}; ${transition}` + return `width: ${width}; position: ${position};` }, headMenuData() { const {layout, menuData, firstMenu} = this @@ -127,10 +131,22 @@ export default { .virtual-side{ transition: all 0.2s; } + .virtual-header{ + transition: all 0.2s; + opacity: 0; + &.fixed-tabs.multi-page:not(.fixed-header){ + height: 0; + } + } .admin-layout-main{ .admin-header{ top: 0; right: 0; + overflow: hidden; + transition: all 0.2s; + &.fixed-tabs.multi-page:not(.fixed-header){ + height: 0; + } } } .admin-layout-content{ diff --git a/src/layouts/tabs/TabsHead.vue b/src/layouts/tabs/TabsHead.vue new file mode 100644 index 0000000..17e74db --- /dev/null +++ b/src/layouts/tabs/TabsHead.vue @@ -0,0 +1,155 @@ + + + + + \ No newline at end of file diff --git a/src/layouts/tabs/TabsView.vue b/src/layouts/tabs/TabsView.vue index d97cf1e..73a9828 100644 --- a/src/layouts/tabs/TabsView.vue +++ b/src/layouts/tabs/TabsView.vue @@ -1,20 +1,14 @@