功能:适配前端宽屏桌面布局

This commit is contained in:
xiaowang
2026-03-24 09:50:55 +08:00
parent 8043f13ea9
commit 5302af0c1a
13 changed files with 229 additions and 53 deletions
+33 -5
View File
@@ -4,11 +4,19 @@
<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
class="page-renderer"
:class="{
'centered-user-shell': shouldCenterUserContent,
'admin-renderer': isAdminRoute
}"
>
<router-view v-slot="{ Component }">
<transition name="page-fade" mode="out-in">
<component :is="Component" :key="route.path" />
</transition>
</router-view>
</div>
</div>
</div>
</ConfigProvider>
@@ -32,6 +40,16 @@ const isHiddenNav = computed(() => {
return result
})
const isAdminRoute = computed(() => route.matched.some(r => r.meta.isAdmin))
const shouldCenterUserContent = computed(() => {
if (isAdminRoute.value) {
return false
}
return route.name !== 'auth' && route.name !== 'not-found'
})
// 全局购物车数量状态
const cartCount = ref(0)
@@ -98,6 +116,16 @@ loadCartCount()
z-index: 1;
}
.page-renderer {
min-height: 100%;
}
.page-renderer.centered-user-shell > * {
width: 100%;
max-width: var(--frontend-page-max-width);
margin: 0 auto;
}
/* 当导航栏隐藏时,移除底部 padding */
.page-content.no-nav-padding {
padding-bottom: 0;