refactor layout
This commit is contained in:
+14
-27
@@ -1,11 +1,10 @@
|
||||
<template>
|
||||
<div class="main-layout">
|
||||
<app-nav-bar @height-change="onChangeNavBarHeight" />
|
||||
<div class="router-view">
|
||||
<div class="main-layout diselect">
|
||||
<div class="content">
|
||||
<page-transition
|
||||
:keep-alive="shouldKeepAlive"
|
||||
:page-background="globalUIStore.bodyBackground"
|
||||
page-class="page"
|
||||
:page-class="pageClass"
|
||||
:respect-reduced-motion="false"
|
||||
/>
|
||||
</div>
|
||||
@@ -37,7 +36,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import AppNavBar from "@/components/navbar/index.vue";
|
||||
import { useGlobalUIStore } from "@/store/globalUI";
|
||||
import { useTabBarStore } from "@/store/tabBarStore";
|
||||
import { permissionCodes } from "@/utils/permission";
|
||||
@@ -57,14 +55,6 @@ function shouldKeepAlive(sourceRoute: RouteLocationNormalizedLoaded): boolean {
|
||||
return cachedRouteNames.has(String(sourceRoute.name));
|
||||
}
|
||||
|
||||
// ---------- 导航边距 ----------
|
||||
|
||||
const navBarHeight = ref("0px");
|
||||
|
||||
function onChangeNavBarHeight(value: string): void {
|
||||
navBarHeight.value = value;
|
||||
}
|
||||
|
||||
// ---------- Tab 切换 ----------
|
||||
|
||||
type TabItem = {
|
||||
@@ -174,24 +164,21 @@ const isTabBarPaddingNeeded = computed(() => {
|
||||
return route.meta.tabBarPadding !== false;
|
||||
});
|
||||
|
||||
const tabBarHeight = computed(() => {
|
||||
if (isTabBarPaddingNeeded.value) {
|
||||
return "6rem";
|
||||
}
|
||||
const pageClass = computed(() => ({
|
||||
"page-layout": true,
|
||||
navbar: true,
|
||||
tabbar: isTabBarPaddingNeeded.value
|
||||
}));
|
||||
|
||||
return "0rem";
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped lang="less">
|
||||
.main-layout {
|
||||
--app-nav-height: v-bind(navBarHeight);
|
||||
--app-tab-height: v-bind(tabBarHeight);
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
height: 100%;
|
||||
transition: padding-bottom .24s ease;
|
||||
|
||||
.router-view {
|
||||
.content {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
@@ -202,9 +189,9 @@ const tabBarHeight = computed(() => {
|
||||
bottom: 1rem;
|
||||
opacity: 1;
|
||||
transform: translateY(0);
|
||||
backdrop-filter: blur(10px);
|
||||
pointer-events: auto;
|
||||
transition: opacity 520ms, transform 520ms var(--tui-bezier);
|
||||
pointer-events: auto;
|
||||
backdrop-filter: blur(10px);
|
||||
|
||||
&.is-hidden {
|
||||
opacity: 0;
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
<template>
|
||||
<div class="root-layout diselect">
|
||||
<router-view />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
defineOptions({
|
||||
name: "RootLayout"
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
.root-layout {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: relative;
|
||||
min-height: 100vh;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user