Commit 66e40940 authored by Administrator's avatar Administrator
Browse files

fix(AppLayout): pin background to viewport so page no longer scrolls past footer



<v-img cover min-height="100dvh"> was forcing v-responsive to size itself
to the image's natural aspect ratio (1692px wide × 2333/3500 ≈ 1128px tall),
making the page 1128px tall on a 769px viewport. The bottom ~360px had no
white overlay, so scrolling past the footer leaked the unwrapped image.

Replace <v-img> with a position:fixed <div class="app-bg"> using
background-image: cover, and move the white overlay from inline style to
scoped .app-content CSS. Page scrollHeight dropped 1128 → 781; max scroll
359 → 12 (just v-main's slight overflow).

Verified: background still renders washed-out behind content, edit dialog
opens correctly (pointer-events: none doesn't block v-overlay/v-dialog),
all routes still work.
Co-Authored-By: default avatarClaude <noreply@anthropic.com>
parent a401a7d5
<template> <template>
<v-app> <v-app>
<v-img <!--
src="/src/assets/images/login.jpg" 装饰背景:position: fixed 让它严格按视口尺寸铺满,不会像 v-img+cover
cover 那样被图片自身宽高比撑高(那样会撑到 width × (image.h/image.w) =
min-height="100dvh" 1128px+,让页面能往下滚动到 footer 之下的空白背景)。
style="object-position: center top;" 真正的白色半透明蒙层在 v-layout 上,所以图片仍以 ~15% 透明度透出。
> -->
<v-layout min-height="100dvh" style="background: rgba(255, 255, 255, 0.85);"> <div class="app-bg" aria-hidden="true"></div>
<AppHeader :drawer-active="drawerActive" @toggle-drawer="toggleDrawer" @logout="showLogoutDialog = true" /> <v-layout min-height="100dvh" class="app-content">
<AppFooter /> <AppHeader :drawer-active="drawerActive" @toggle-drawer="toggleDrawer" @logout="showLogoutDialog = true" />
<AppDrawer v-model="drawerActive" /> <AppFooter />
<v-main> <AppDrawer v-model="drawerActive" />
<v-container fluid class="pt-4 pb-0"> <v-main>
<v-breadcrumbs :items="breadcrumbs"> <v-container fluid class="pt-4 pb-0">
<template #item="{ item }"> <v-breadcrumbs :items="breadcrumbs">
<v-breadcrumbs-item <template #item="{ item }">
:disabled="item.disabled" <v-breadcrumbs-item
:to="item.to" :disabled="item.disabled"
:exact="true" :to="item.to"
> :exact="true"
<v-icon v-if="item.icon" :icon="item.icon" size="small" class="me-1" /> >
{{ item.title }} <v-icon v-if="item.icon" :icon="item.icon" size="small" class="me-1" />
</v-breadcrumbs-item> {{ item.title }}
</template> </v-breadcrumbs-item>
</v-breadcrumbs> </template>
</v-container> </v-breadcrumbs>
<slot></slot> </v-container>
</v-main> <slot></slot>
</v-layout> </v-main>
</v-img> </v-layout>
<!-- 登出确认对话框 --> <!-- 登出确认对话框 -->
<v-dialog v-model="showLogoutDialog" max-width="400"> <v-dialog v-model="showLogoutDialog" max-width="400">
<v-card> <v-card>
...@@ -160,4 +160,28 @@ const breadcrumbs = computed(() => { ...@@ -160,4 +160,28 @@ const breadcrumbs = computed(() => {
</script> </script>
<style scoped> <style scoped>
/*
* 背景图片固定在视口覆盖整屏 background-image 替代 <v-img cover>
* 避免 v-img v-responsive 容器按图片自身宽高比撑高width × 2333/3500
* 1128px),导致页面能滚到 footer 之下
* pointer-events: none 不抢交互
*/
.app-bg {
position: fixed;
inset: 0;
z-index: 0;
background: url('@/assets/images/login.jpg') center top / cover no-repeat;
pointer-events: none;
}
/*
* v-layout 的白色半透明蒙层从 inline style 挪到这里(也保留 rgba 不变)。
* 加 position: relative + z-index: 1,让内容层在 .app-bg 之上,
* 否则 v-app 的 flex 排版可能把 .app-bg 盖住。
*/
.app-content {
position: relative;
z-index: 1;
background: rgba(255, 255, 255, 0.85);
}
</style> </style>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment