2026-02-13 17:34:32 +08:00
|
|
|
<template>
|
|
|
|
|
<el-config-provider>
|
|
|
|
|
<div class="app-container">
|
|
|
|
|
<BottomNav v-if="!isHiddenNav" />
|
|
|
|
|
<div class="page-content" :class="{ 'no-nav-padding': isHiddenNav }">
|
|
|
|
|
<router-view v-slot="{ Component }">
|
|
|
|
|
<transition name="page-fade" mode="out-in">
|
|
|
|
|
<component :is="Component" :key="route.path" />
|
|
|
|
|
</transition>
|
|
|
|
|
</router-view>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</el-config-provider>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { computed } from 'vue'
|
|
|
|
|
import { useRoute } from 'vue-router'
|
|
|
|
|
import BottomNav from './components/BottomNav.vue'
|
|
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
|
|
|
|
|
const isHiddenNav = computed(() => {
|
2026-02-26 17:54:18 +08:00
|
|
|
// 检查当前路由及其所有父路由是否有 hideNav: true
|
2026-02-28 14:32:28 +08:00
|
|
|
// 或者检查是否是后台页面
|
|
|
|
|
const result = route.matched.some(r => r.meta.hideNav) || route.matched.some(r => r.meta.isAdmin)
|
2026-02-26 17:54:18 +08:00
|
|
|
console.log('isHiddenNav:', result, 'matched routes:', route.matched)
|
|
|
|
|
return result
|
2026-02-13 17:34:32 +08:00
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style>
|
|
|
|
|
#app {
|
|
|
|
|
font-family: Avenir, Helvetica, Arial, sans-serif;
|
|
|
|
|
-webkit-font-smoothing: antialiased;
|
|
|
|
|
-moz-osx-font-smoothing: grayscale;
|
|
|
|
|
color: #2c3e50;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.app-container {
|
|
|
|
|
min-height: 100vh;
|
|
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.page-content {
|
|
|
|
|
flex: 1;
|
|
|
|
|
padding-bottom: 60px;
|
|
|
|
|
position: relative;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 当导航栏隐藏时,移除底部 padding */
|
|
|
|
|
.page-content.no-nav-padding {
|
|
|
|
|
padding-bottom: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.fade-enter-active,
|
|
|
|
|
.fade-leave-active {
|
|
|
|
|
transition: opacity 0.2s ease;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.fade-enter-from {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.fade-leave-to {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.page-fade-enter-active,
|
|
|
|
|
.page-fade-leave-active {
|
|
|
|
|
transition: opacity 0.2s ease;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.page-fade-enter-from {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.page-fade-leave-to {
|
|
|
|
|
opacity: 0;
|
|
|
|
|
}
|
|
|
|
|
</style>
|