mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-05 19:41:57 +08:00
refactor: layout组件兼容性更好,升级fes-design版本 (#100)
This commit is contained in:
parent
1e033d488f
commit
50db7dc908
@ -52,7 +52,7 @@
|
|||||||
"@fesjs/plugin-layout": "^4.0.0",
|
"@fesjs/plugin-layout": "^4.0.0",
|
||||||
"@fesjs/plugin-model": "^2.0.0",
|
"@fesjs/plugin-model": "^2.0.0",
|
||||||
"@fesjs/plugin-enums": "^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",
|
"vue": "^3.2.6",
|
||||||
"core-js": "^3.8.3"
|
"core-js": "^3.8.3"
|
||||||
},
|
},
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@fesjs/fes": "^2.0.0",
|
"@fesjs/fes": "^2.0.0",
|
||||||
"@fesjs/fes-design": "^0.2.6",
|
"@fesjs/fes-design": "^0.3.3",
|
||||||
"vue": "^3.0.5"
|
"vue": "^3.0.5"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<template v-if="navigation === 'side'">
|
<template v-if="navigation === 'side'">
|
||||||
<f-aside
|
<f-aside
|
||||||
v-if="routeLayout.sidebar"
|
v-if="routeLayout.sidebar"
|
||||||
v-model:collapsed="collapsed"
|
v-model:collapsed="collapsedRef"
|
||||||
:fixed="fixedSideBar"
|
:fixed="fixedSideBar"
|
||||||
:width="`${sideWidth}px`"
|
:width="`${sideWidth}px`"
|
||||||
class="layout-aside"
|
class="layout-aside"
|
||||||
@ -17,26 +17,20 @@
|
|||||||
<Menu
|
<Menu
|
||||||
class="layout-menu"
|
class="layout-menu"
|
||||||
:menus="menus"
|
:menus="menus"
|
||||||
:collapsed="collapsed"
|
:collapsed="collapsedRef"
|
||||||
mode="vertical"
|
mode="vertical"
|
||||||
:inverted="theme === 'dark'"
|
:inverted="theme === 'dark'"
|
||||||
/>
|
/>
|
||||||
</f-aside>
|
</f-aside>
|
||||||
<f-layout
|
<f-layout
|
||||||
:fixed="fixedSideBar"
|
:fixed="fixedSideBar"
|
||||||
:style="{
|
:style="sideStyleRef"
|
||||||
left: fixedSideBar
|
|
||||||
? collapsed
|
|
||||||
? '48px'
|
|
||||||
: `${sideWidth}px`
|
|
||||||
: 'auto'
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<f-header
|
<f-header
|
||||||
v-if="routeLayout.header"
|
v-if="routeLayout.header"
|
||||||
ref="headerRef"
|
ref="headerRef"
|
||||||
class="layout-header"
|
class="layout-header"
|
||||||
:fixed="currentFixedHeader"
|
:fixed="currentFixedHeaderRef"
|
||||||
>
|
>
|
||||||
<div class="layout-header-custom">
|
<div class="layout-header-custom">
|
||||||
<slot name="customHeader"></slot>
|
<slot name="customHeader"></slot>
|
||||||
@ -47,8 +41,8 @@
|
|||||||
</f-header>
|
</f-header>
|
||||||
<f-layout
|
<f-layout
|
||||||
:embedded="!multiTabs"
|
:embedded="!multiTabs"
|
||||||
:fixed="currentFixedHeader"
|
:fixed="currentFixedHeaderRef"
|
||||||
:style="{ top: currentFixedHeader ? `${headerHeightRef}px` : 'auto' }"
|
:style="headerStyleRef"
|
||||||
>
|
>
|
||||||
<f-main class="layout-main">
|
<f-main class="layout-main">
|
||||||
<MultiTabProvider :multiTabs="multiTabs" />
|
<MultiTabProvider :multiTabs="multiTabs" />
|
||||||
@ -65,7 +59,7 @@
|
|||||||
ref="headerRef"
|
ref="headerRef"
|
||||||
class="layout-header"
|
class="layout-header"
|
||||||
:inverted="theme === 'dark'"
|
:inverted="theme === 'dark'"
|
||||||
:fixed="currentFixedHeader"
|
:fixed="currentFixedHeaderRef"
|
||||||
>
|
>
|
||||||
<div v-if="routeLayout.logo" class="layout-logo">
|
<div v-if="routeLayout.logo" class="layout-logo">
|
||||||
<img :src="logo" class="logo-img" />
|
<img :src="logo" class="logo-img" />
|
||||||
@ -86,8 +80,8 @@
|
|||||||
</f-header>
|
</f-header>
|
||||||
<f-layout
|
<f-layout
|
||||||
:embedded="!multiTabs"
|
:embedded="!multiTabs"
|
||||||
:fixed="currentFixedHeader"
|
:fixed="currentFixedHeaderRef"
|
||||||
:style="{ top: currentFixedHeader ? `${headerHeightRef}px` : 'auto' }"
|
:style="headerStyleRef"
|
||||||
>
|
>
|
||||||
<f-main class="layout-main">
|
<f-main class="layout-main">
|
||||||
<MultiTabProvider :multiTabs="multiTabs" />
|
<MultiTabProvider :multiTabs="multiTabs" />
|
||||||
@ -102,7 +96,7 @@
|
|||||||
v-if="routeLayout.header"
|
v-if="routeLayout.header"
|
||||||
ref="headerRef"
|
ref="headerRef"
|
||||||
class="layout-header"
|
class="layout-header"
|
||||||
:fixed="currentFixedHeader"
|
:fixed="currentFixedHeaderRef"
|
||||||
:inverted="theme === 'dark'"
|
:inverted="theme === 'dark'"
|
||||||
>
|
>
|
||||||
<div v-if="routeLayout.logo" class="layout-logo">
|
<div v-if="routeLayout.logo" class="layout-logo">
|
||||||
@ -116,13 +110,10 @@
|
|||||||
<slot name="locale"></slot>
|
<slot name="locale"></slot>
|
||||||
</template>
|
</template>
|
||||||
</f-header>
|
</f-header>
|
||||||
<f-layout
|
<f-layout :fixed="currentFixedHeaderRef" :style="headerStyleRef">
|
||||||
:fixed="currentFixedHeader"
|
|
||||||
:style="{ top: currentFixedHeader ? `${headerHeightRef}px` : 'auto' }"
|
|
||||||
>
|
|
||||||
<f-aside
|
<f-aside
|
||||||
v-if="routeLayout.sidebar"
|
v-if="routeLayout.sidebar"
|
||||||
v-model:collapsed="collapsed"
|
v-model:collapsed="collapsedRef"
|
||||||
:fixed="fixedSideBar"
|
:fixed="fixedSideBar"
|
||||||
:width="`${sideWidth}px`"
|
:width="`${sideWidth}px`"
|
||||||
collapsible
|
collapsible
|
||||||
@ -131,20 +122,14 @@
|
|||||||
<Menu
|
<Menu
|
||||||
class="layout-menu"
|
class="layout-menu"
|
||||||
:menus="menus"
|
:menus="menus"
|
||||||
:collapsed="collapsed"
|
:collapsed="collapsedRef"
|
||||||
mode="vertical"
|
mode="vertical"
|
||||||
/>
|
/>
|
||||||
</f-aside>
|
</f-aside>
|
||||||
<f-layout
|
<f-layout
|
||||||
:embedded="!multiTabs"
|
:embedded="!multiTabs"
|
||||||
:fixed="fixedSideBar"
|
:fixed="fixedSideBar"
|
||||||
:style="{
|
:style="sideStyleRef"
|
||||||
left: fixedSideBar
|
|
||||||
? collapsed
|
|
||||||
? '48px'
|
|
||||||
: `${sideWidth}px`
|
|
||||||
: 'auto'
|
|
||||||
}"
|
|
||||||
>
|
>
|
||||||
<f-main class="layout-main">
|
<f-main class="layout-main">
|
||||||
<MultiTabProvider :multiTabs="multiTabs" />
|
<MultiTabProvider :multiTabs="multiTabs" />
|
||||||
@ -234,7 +219,7 @@ export default {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const collapsed = ref(false);
|
const collapsedRef = ref(false);
|
||||||
const route = useRoute();
|
const route = useRoute();
|
||||||
const runtimeConfig = plugin.applyPlugins({
|
const runtimeConfig = plugin.applyPlugins({
|
||||||
key: 'layout',
|
key: 'layout',
|
||||||
@ -271,16 +256,24 @@ export default {
|
|||||||
}
|
}
|
||||||
return config;
|
return config;
|
||||||
});
|
});
|
||||||
const currentFixedHeader = computed(
|
const currentFixedHeaderRef = computed(
|
||||||
() => props.fixedHeader || props.navigation === 'mixin'
|
() => 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 {
|
return {
|
||||||
headerRef,
|
headerRef,
|
||||||
headerHeightRef,
|
headerHeightRef,
|
||||||
route,
|
route,
|
||||||
routeLayout,
|
routeLayout,
|
||||||
collapsed,
|
collapsedRef,
|
||||||
currentFixedHeader
|
currentFixedHeaderRef,
|
||||||
|
headerStyleRef,
|
||||||
|
sideStyleRef
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -34,7 +34,7 @@ export default {
|
|||||||
title: 'Fes.js',
|
title: 'Fes.js',
|
||||||
footer: 'Created by MumbleFE',
|
footer: 'Created by MumbleFE',
|
||||||
multiTabs: false,
|
multiTabs: false,
|
||||||
navigation: 'mixin',
|
navigation: 'side',
|
||||||
theme: 'dark',
|
theme: 'dark',
|
||||||
menus: [
|
menus: [
|
||||||
{
|
{
|
||||||
@ -64,10 +64,6 @@ export default {
|
|||||||
title: '子菜单',
|
title: '子菜单',
|
||||||
path: '/menuTest'
|
path: '/menuTest'
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: '子菜单a',
|
|
||||||
path: '/menuTest/a'
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
"@fesjs/plugin-monaco-editor": "^2.0.0-beta.0",
|
"@fesjs/plugin-monaco-editor": "^2.0.0-beta.0",
|
||||||
"@fesjs/plugin-windicss": "^2.0.0",
|
"@fesjs/plugin-windicss": "^2.0.0",
|
||||||
"@fesjs/plugin-pinia": "^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",
|
"vue": "^3.0.5",
|
||||||
"vuex": "^4.0.0",
|
"vuex": "^4.0.0",
|
||||||
"pinia": "^2.0.11"
|
"pinia": "^2.0.11"
|
||||||
|
@ -21,6 +21,7 @@ export default {
|
|||||||
|
|
||||||
<style>
|
<style>
|
||||||
.page {
|
.page {
|
||||||
|
height: 1000px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -1,14 +1,23 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
menuTest-a
|
menuTest: {{route.params}}
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
"title": "menuTest-详情"
|
||||||
|
}
|
||||||
|
</config>
|
||||||
<script>
|
<script>
|
||||||
|
import { useRoute } from '@fesjs/fes';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
},
|
},
|
||||||
setup() {
|
setup() {
|
||||||
|
const route = useRoute();
|
||||||
return {
|
return {
|
||||||
|
route
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -3,6 +3,11 @@
|
|||||||
menuTest-index
|
menuTest-index
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<config>
|
||||||
|
{
|
||||||
|
"title": "menuTest"
|
||||||
|
}
|
||||||
|
</config>
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
8
packages/fes-template/src/pages/menuTest/layout.vue
Normal file
8
packages/fes-template/src/pages/menuTest/layout.vue
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
<template>
|
||||||
|
<div style="display: flex;flex-direction: column;">
|
||||||
|
<router-link to="/menuTest/1">Go to 1</router-link>
|
||||||
|
<router-link to="/menuTest/2">Go to 2</router-link>
|
||||||
|
<router-link to="/menuTest/3">Go to 3</router-link>
|
||||||
|
</div>
|
||||||
|
<router-view />
|
||||||
|
</template>
|
@ -1453,10 +1453,10 @@
|
|||||||
minimatch "^3.0.4"
|
minimatch "^3.0.4"
|
||||||
strip-json-comments "^3.1.1"
|
strip-json-comments "^3.1.1"
|
||||||
|
|
||||||
"@fesjs/fes-design@^0.2.10":
|
"@fesjs/fes-design@^0.3.3":
|
||||||
version "0.2.11"
|
version "0.3.3"
|
||||||
resolved "https://registry.npmmirror.com/@fesjs/fes-design/-/fes-design-0.2.11.tgz#b0b7857e8122e787206ba0166f6c7b894a323b28"
|
resolved "https://registry.npmmirror.com/@fesjs/fes-design/-/fes-design-0.3.3.tgz#c78a1ec37869de7e12ae94468fbb0fb04e0d6a81"
|
||||||
integrity sha512-kunu3gOHsDied7XT57btH7WkhyAe4WNvKHoSsFzYlMmvT3wIW9RlYlmebD8e7SRCq12Ule1F+7YdYHDf/w6v/A==
|
integrity sha512-wSbgMzsBILHhHhUV8EqYBLJYn3r0chO7jCx0dpIEDHxGmve8yUL3G23saJLFKF28P/GUEHr5u4iUf8b05+sgNg==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@babel/runtime" "^7.16.3"
|
"@babel/runtime" "^7.16.3"
|
||||||
"@juggle/resize-observer" "^3.3.1"
|
"@juggle/resize-observer" "^3.3.1"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user