在轮播图管理等列表页面,顶部有白色方块遮挡了"添加"按钮和页面标题,影响功能使用。
在 list-common.css 中,工具栏卡片(.toolbar-card)使用了 slideInDown(从上往下滑入)动画:
/* ❌ 问题代码 */
.toolbar-card {
animation: slideInDown 0.6s ease-out; /* 从上往下滑入 */
}
同时,页面标题(.page-title)使用了 slideInLeft(从左往右滑入)动画:
/* ❌ 问题代码 */
.page-title {
animation: slideInLeft 0.6s ease-out; /* 从左往右滑入 */
}
导致的问题:
修改前:
.toolbar-card {
margin-bottom: var(--spacing-lg);
background-color: var(--bg-primary);
border: 1px solid var(--border-color);
transition: all var(--transition-base);
animation: slideInDown 0.6s ease-out; /* ❌ 会遮挡标题 */
}
修改后:
.toolbar-card {
margin-bottom: var(--spacing-lg);
background-color: var(--bg-primary);
border: 1px solid var(--border-color);
transition: all var(--transition-base);
animation: fadeIn 0.5s ease-out; /* ✅ 淡入效果,不会遮挡 */
/* 移除 slideInDown 动画,避免遮挡页面标题 */
}
修改前:
.page-title {
font-size: var(--font-3xl);
font-weight: var(--font-bold);
color: var(--text-primary);
margin: 0 0 var(--spacing-xl) 0;
position: relative;
padding-bottom: var(--spacing-md);
animation: slideInLeft 0.6s ease-out; /* ❌ 从左滑入 */
}
修改后:
.page-title {
font-size: var(--font-3xl);
font-weight: var(--font-bold);
color: var(--text-primary);
margin: 0 0 var(--spacing-xl) 0;
position: relative;
padding-bottom: var(--spacing-md);
animation: fadeIn 0.4s ease-out; /* ✅ 淡入效果 */
/* 使用 fadeIn 代替 slideInLeft,避免动画冲突 */
}
┌─────────────────────────────────┐
│ 轮 ⬜ (白色方块遮挡) │
├─────────────────────────────────┤
│ [新增] [刷新] [搜索框] ← 被遮挡 │
└─────────────────────────────────┘
┌─────────────────────────────────┐
│ 轮播图管理 │
├─────────────────────────────────┤
│ [新增轮播图] [刷新] [搜索框] │
└─────────────────────────────────┘
| 元素 | 动画 | 问题 |
|---|---|---|
| 页面标题 | slideInLeft |
从左滑入,与工具栏冲突 |
| 工具栏 | slideInDown |
从上滑下,会遮挡标题 |
| 元素 | 动画 | 优点 |
|---|---|---|
| 页面标题 | fadeIn (0.4s) |
淡入效果,不会位移 |
| 工具栏 | fadeIn (0.5s) |
淡入效果,不会遮挡 |
刷新页面
按 Ctrl + F5 强制刷新浏览器
检查各个列表页面
检查动画效果
所有使用通用列表样式的页面都会受益:
BannerList.vue)UserList.vue)ActivityList.vue)MatchmakerList.vue)CourseList.vue)list-common.css 的页面src/assets/list-common.css - 通用列表样式.page-title 动画:slideInLeft → fadeIn.toolbar-card 动画:slideInDown → fadeIn✅ 简洁优雅 - 不喧宾夺主 ✅ 快速流畅 - 不影响操作效率 ✅ 避免遮挡 - 不干扰用户阅读和点击 ✅ 统一协调 - 整体风格一致 ✅ 性能优先 - 不影响页面性能
如果未来需要更丰富的动画效果,建议:
使用延迟动画
.page-title {
animation: fadeIn 0.4s ease-out;
}
.toolbar-card {
animation: fadeIn 0.5s ease-out 0.2s; /* 延迟 0.2s */
animation-fill-mode: both;
}
使用分层动画
.page-title {
z-index: 10; /* 确保在上层 */
animation: fadeIn 0.4s ease-out;
}
.toolbar-card {
z-index: 5; /* 在下层 */
animation: fadeIn 0.5s ease-out;
}
使用渐进式动画
.page-title {
animation: fadeIn 0.3s ease-out;
}
.toolbar-card {
animation: fadeIn 0.3s ease-out 0.1s;
}
.table-card {
animation: fadeIn 0.3s ease-out 0.2s;
}
slideInDown 动画导致工具栏从上往下滑入时遮挡标题slideInDown 和 slideInLeft 改为 fadeIn修复时间: 2024-10-25
修复文件: src/assets/list-common.css
修复内容: 优化页面动画,避免遮挡
影响范围: 所有使用通用列表样式的页面
测试状态: ✅ 已修复并优化