Skip to content

Commit e35bbc7

Browse files
committed
feat(docs): update Vite server configuration and enhance background decoration with fade-in animation
1 parent ec93670 commit e35bbc7

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

docs/src/motion/background-decoration.vue

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const particles = computed(() => {
6464
</script>
6565

6666
<template>
67-
<div class="absolute inset-0 overflow-hidden pointer-events-none select-none">
67+
<div class="bg-decoration absolute inset-0 overflow-hidden pointer-events-none select-none">
6868
<!-- Grid Background -->
6969
<div
7070
class="absolute inset-0 bg-[linear-gradient(to_right,#80808012_1px,transparent_1px),linear-gradient(to_bottom,#80808012_1px,transparent_1px)] bg-[size:24px_24px] [mask-image:radial-gradient(ellipse_60%_50%_at_50%_0%,#000_70%,transparent_100%)]"
@@ -74,7 +74,7 @@ const particles = computed(() => {
7474
<div
7575
v-for="(orb, index) in orbs"
7676
:key="index"
77-
class="absolute rounded-full blur-[100px]"
77+
class="absolute rounded-full blur-[100px] will-change-transform"
7878
:class="[orb.size, orb.color]"
7979
:style="{
8080
left: `${(index + 1) * 20}%`,
@@ -92,9 +92,33 @@ const particles = computed(() => {
9292
top: `${particle.top}%`,
9393
animationDelay: `${particle.delay}ms`
9494
}"
95-
class="absolute rounded-full animate-ping"
95+
class="absolute rounded-full animate-ping will-change-transform"
9696
:class="[particle.color, particle.size]"
9797
/>
9898
</div>
9999
</div>
100100
</template>
101+
102+
<style scoped>
103+
.bg-decoration {
104+
opacity: 0;
105+
animation: fadeIn 0.3s ease-out forwards;
106+
}
107+
108+
@keyframes fadeIn {
109+
from {
110+
opacity: 0;
111+
}
112+
to {
113+
opacity: 1;
114+
}
115+
}
116+
117+
/* 移动端优化:减少初始渲染闪烁 */
118+
@media (max-width: 768px) {
119+
.bg-decoration {
120+
animation: fadeIn 0.5s ease-out forwards;
121+
will-change: opacity;
122+
}
123+
}
124+
</style>

docs/src/pages/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const features = computed(() => [
3636

3737
<template>
3838
<div
39-
class="min-h-screen flex flex-col items-center justify-center p-4 overflow-hidden bg-gradient-to-b from-white to-gray-50 dark:from-gray-950 dark:to-gray-900 relative font-sans"
39+
class="relative min-h-screen flex flex-col items-center justify-center p-4 overflow-hidden bg-gradient-to-b from-white to-gray-50 dark:from-gray-950 dark:to-gray-900 font-sans"
4040
>
4141
<BackgroundDecoration />
4242

docs/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ export default defineConfig({
9595
noExternal: ['workbox-window', /vue-i18n/]
9696
},
9797
server: {
98+
host: '0.0.0.0',
9899
port: 5174,
99100
open: true
100101
}

0 commit comments

Comments
 (0)