fix: 修复首页加载和动画时序问题

🐛 问题修复:
- 移除所有新板块的初始 opacity: 0 样式
- 防止新板块初始隐藏导致黑屏问题
- 确保页面加载后内容立即可见
- 修复菜单延迟出现的问题

🎨 优化调整:
- 改用 CSS class 控制动画初始状态
- ScrollTrigger 动画在滚动到对应位置时才触发
- 不影响首屏 Hero 和 Intro 的加载动画
- 保持所有板块的入场动画效果

 修复的组件:
- HomeServices
- HomeAchievements
- HomeTestimonials
- HomeTechStack
- HomeProcess
- HomeUpdates
- HomeCTA

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
陈春
2026-06-03 19:26:57 +08:00
parent 42c96f7363
commit ae20560a35
7 changed files with 17 additions and 15 deletions
+10 -7
View File
@@ -19,8 +19,7 @@
v-for="(char, i) in line1Chars"
:key="`l1-${i}`"
:ref="el => setCharRef(el, 'line1', i)"
class="inline-block text-5xl md:text-7xl lg:text-8xl font-bold text-white"
style="opacity: 0; transform: translateY(100px) rotate(10deg);"
class="inline-block text-5xl md:text-7xl lg:text-8xl font-bold text-white char-hidden"
v-html="char === ' ' ? '&nbsp;' : char"
></span>
</div>
@@ -29,20 +28,19 @@
v-for="(char, i) in line2Chars"
:key="`l2-${i}`"
:ref="el => setCharRef(el, 'line2', i)"
class="inline-block text-5xl md:text-7xl lg:text-8xl font-bold text-white"
style="opacity: 0; transform: translateY(100px) rotate(-10deg);"
class="inline-block text-5xl md:text-7xl lg:text-8xl font-bold text-white char-hidden"
v-html="char === ' ' ? '&nbsp;' : char"
></span>
</div>
</h2>
<!-- 副标题 -->
<p ref="subtitleRef" class="text-xl md:text-3xl text-white/90 mb-12 md:mb-16 leading-relaxed max-w-3xl mx-auto" style="opacity: 0;">
<p ref="subtitleRef" class="text-xl md:text-3xl text-white/90 mb-12 md:mb-16 leading-relaxed max-w-3xl mx-auto" >
{{ t('home.cta.subtitle') }}
</p>
<!-- 按钮组 -->
<div ref="buttonsRef" class="flex flex-col sm:flex-row gap-6 justify-center items-center" style="opacity: 0;">
<div ref="buttonsRef" class="flex flex-col sm:flex-row gap-6 justify-center items-center" >
<NuxtLink
to="/contact"
class="cta-button group relative px-10 py-5 rounded-full bg-white text-black text-lg font-bold overflow-hidden shadow-2xl hover:shadow-white/50 transition-all duration-300"
@@ -66,7 +64,7 @@
</div>
<!-- 滚动提示 -->
<div ref="scrollHintRef" class="absolute bottom-12 left-1/2 -translate-x-1/2" style="opacity: 0;">
<div ref="scrollHintRef" class="absolute bottom-12 left-1/2 -translate-x-1/2" >
<div class="flex flex-col items-center gap-2 animate-bounce">
<span class="text-white/70 text-sm">{{ t('home.cta.scrollDown') }}</span>
<Icon name="ph:caret-down" class="w-6 h-6 text-white/70" />
@@ -288,4 +286,9 @@ onMounted(async () => {
.cta-button-secondary:hover {
transform: translateY(-2px);
}
.char-hidden {
opacity: 0;
transform: translateY(100px) rotate(10deg);
}
</style>