Skip to content

Commit

Permalink
fix: 修复plugin-layout中body的top计算问题 (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
wanchun authored Jun 28, 2023
1 parent 760172c commit 365f1ef
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
24 changes: 17 additions & 7 deletions packages/fes-plugin-layout/src/runtime/views/BaseLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@
</template>

<script>
import { ref, computed, onMounted } from 'vue';
import { useRoute } from '@@/core/coreExports';
import { ref, computed, watch, nextTick } from 'vue';
import { useRoute, useRouter } from '@@/core/coreExports';
import { FLayout, FAside, FMain, FFooter, FHeader } from '@fesjs/fes-design';
import defaultLogo from '../assets/logo.png';
import Menu from './Menu.vue';
Expand Down Expand Up @@ -235,6 +235,7 @@ export default {
const headerHeightRef = ref(0);
const collapsedRef = ref(false);
const route = useRoute();
const router = useRouter();
const currentNavigation = computed(() => {
if (route.meta.layout && route.meta.layout.navigation !== undefined) {
Expand All @@ -250,11 +251,20 @@ export default {
return props.isFixedSidebar ? { left } : null;
});
onMounted(() => {
if (headerRef.value) {
headerHeightRef.value = headerRef.value.$el.offsetHeight;
}
});
watch(
router.currentRoute,
() => {
nextTick(() => {
if (headerRef.value) {
headerHeightRef.value = headerRef.value.$el.offsetHeight;
}
});
},
{
immediate: true,
},
);
return {
headerRef,
headerHeightRef,
Expand Down
2 changes: 1 addition & 1 deletion packages/fes-template/.fes.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineBuildConfig({
title: 'Fes.js',
footer: 'Created by MumbleFE',
multiTabs: true,
navigation: 'side',
navigation: 'mixin',
theme: 'dark',
menus: [
{
Expand Down

0 comments on commit 365f1ef

Please sign in to comment.