From 50db7dc908d3c684315e395c820263ed94316f16 Mon Sep 17 00:00:00 2001 From: harrywan <445436867@qq.com> Date: Tue, 22 Feb 2022 19:02:43 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20layout=E7=BB=84=E4=BB=B6=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7=E6=9B=B4=E5=A5=BD,=E5=8D=87=E7=BA=A7fes-desi?= =?UTF-8?q?gn=E7=89=88=E6=9C=AC=20(#100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/app/pc/package.json | 2 +- packages/fes-plugin-layout/package.json | 2 +- .../src/runtime/views/BaseLayout.vue | 59 ++++++++----------- packages/fes-template/.fes.js | 6 +- packages/fes-template/package.json | 2 +- packages/fes-template/src/pages/index.vue | 1 + .../src/pages/menuTest/{a.vue => @id.vue} | 11 +++- .../fes-template/src/pages/menuTest/index.vue | 5 ++ .../src/pages/menuTest/layout.vue | 8 +++ yarn.lock | 8 +-- 10 files changed, 58 insertions(+), 46 deletions(-) rename packages/fes-template/src/pages/menuTest/{a.vue => @id.vue} (54%) create mode 100644 packages/fes-template/src/pages/menuTest/layout.vue diff --git a/packages/create-fes-app/templates/app/pc/package.json b/packages/create-fes-app/templates/app/pc/package.json index e6c3065f..54b42aa4 100644 --- a/packages/create-fes-app/templates/app/pc/package.json +++ b/packages/create-fes-app/templates/app/pc/package.json @@ -52,7 +52,7 @@ "@fesjs/plugin-layout": "^4.0.0", "@fesjs/plugin-model": "^2.0.0", "@fesjs/plugin-enums": "^2.0.0", - "@fesjs/fes-design": "^0.2.6", + "@fesjs/fes-design": "^0.3.0", "vue": "^3.2.6", "core-js": "^3.8.3" }, diff --git a/packages/fes-plugin-layout/package.json b/packages/fes-plugin-layout/package.json index 7223dc9b..15c1c502 100644 --- a/packages/fes-plugin-layout/package.json +++ b/packages/fes-plugin-layout/package.json @@ -31,7 +31,7 @@ }, "peerDependencies": { "@fesjs/fes": "^2.0.0", - "@fesjs/fes-design": "^0.2.6", + "@fesjs/fes-design": "^0.3.3", "vue": "^3.0.5" } } diff --git a/packages/fes-plugin-layout/src/runtime/views/BaseLayout.vue b/packages/fes-plugin-layout/src/runtime/views/BaseLayout.vue index c9643e34..adf1efda 100644 --- a/packages/fes-plugin-layout/src/runtime/views/BaseLayout.vue +++ b/packages/fes-plugin-layout/src/runtime/views/BaseLayout.vue @@ -3,7 +3,7 @@ - + @@ -234,7 +219,7 @@ export default { } }); - const collapsed = ref(false); + const collapsedRef = ref(false); const route = useRoute(); const runtimeConfig = plugin.applyPlugins({ key: 'layout', @@ -271,16 +256,24 @@ export default { } return config; }); - const currentFixedHeader = computed( + const currentFixedHeaderRef = computed( () => props.fixedHeader || props.navigation === 'mixin' ); + const headerStyleRef = computed(() => (currentFixedHeaderRef.value ? { top: `${headerHeightRef.value}px` } : {})); + const sideStyleRef = computed(() => (props.fixedSideBar + ? { + left: collapsedRef.value ? '48px' : `${props.sideWidth}px` + } + : {})); return { headerRef, headerHeightRef, route, routeLayout, - collapsed, - currentFixedHeader + collapsedRef, + currentFixedHeaderRef, + headerStyleRef, + sideStyleRef }; } }; diff --git a/packages/fes-template/.fes.js b/packages/fes-template/.fes.js index e9af40ae..82c2d81d 100644 --- a/packages/fes-template/.fes.js +++ b/packages/fes-template/.fes.js @@ -34,7 +34,7 @@ export default { title: 'Fes.js', footer: 'Created by MumbleFE', multiTabs: false, - navigation: 'mixin', + navigation: 'side', theme: 'dark', menus: [ { @@ -64,10 +64,6 @@ export default { title: '子菜单', path: '/menuTest' }, - { - title: '子菜单a', - path: '/menuTest/a' - } ] }, { diff --git a/packages/fes-template/package.json b/packages/fes-template/package.json index 547fe21a..84fda620 100644 --- a/packages/fes-template/package.json +++ b/packages/fes-template/package.json @@ -60,7 +60,7 @@ "@fesjs/plugin-monaco-editor": "^2.0.0-beta.0", "@fesjs/plugin-windicss": "^2.0.0", "@fesjs/plugin-pinia": "^2.0.0", - "@fesjs/fes-design": "^0.2.10", + "@fesjs/fes-design": "^0.3.3", "vue": "^3.0.5", "vuex": "^4.0.0", "pinia": "^2.0.11" diff --git a/packages/fes-template/src/pages/index.vue b/packages/fes-template/src/pages/index.vue index ec5f7c64..c8fb7f9b 100644 --- a/packages/fes-template/src/pages/index.vue +++ b/packages/fes-template/src/pages/index.vue @@ -21,6 +21,7 @@ export default { diff --git a/packages/fes-template/src/pages/menuTest/a.vue b/packages/fes-template/src/pages/menuTest/@id.vue similarity index 54% rename from packages/fes-template/src/pages/menuTest/a.vue rename to packages/fes-template/src/pages/menuTest/@id.vue index cb0d9d84..4977d60f 100644 --- a/packages/fes-template/src/pages/menuTest/a.vue +++ b/packages/fes-template/src/pages/menuTest/@id.vue @@ -1,14 +1,23 @@ + +{ + "title": "menuTest-详情" +} +