From Showcase Page to Site Entrance: The Architectural Evolution and Door-Opening Transition Practice of the Shouping Landing Page
Translated from Chinese by AI (deepseek-chat). It may differ from the original.
I'd wanted to try grid layout for a long time, and I happened to see imsyy's project layout from years ago. I liked it a lot, so I took it and reworked it into a page that better fits a modern tech stack.
Reexamining the entrance: from a standalone showcase page to a portal
Initially,shouping was just a standalone experimental page mounted under the /shouping route, while the site's original content-stream homepage remained at /. Its purpose was clear and pure:when visitors enter the site, they first perceive the site's tone and the owner's character, and then decide whether to explore the main site or go directly to a specific tool.
As the visuals were polished and the interaction logic gradually matured, its role underwent a qualitative shift—it was no longer just an "auxiliary showcase page," but should be the "front door" of the entire site. We progressively integrated the complete in-site ecosystem, dynamic data dashboards, and immersive transitions into it, and ultimately smoothly swapped it with the original homepage, establishing it as the site's official entrance (the page was inspired by(imsyy)'s beginner project from years ago).
Layout skeleton evolution: 1:1 symmetry
Left-right symmetrical visual balance
The outermost layer of the page uses an immersive full-screen pure dark background (bg-[#282a30]【NuxtUI默认】) [NuxtUI default], and the main content is horizontally and vertically centered through a centered container (max-w-7xl mx-auto).
Many pages are used to asymmetric divisions like 5:7 or 4:8, but in a card-centric personal homepage, using a strict 1:1 (grid-cols-1 lg:grid-cols-2) symmetrical split on the left and right is the best solution for visual balance (originally I wanted a 5:7 split, but the effect wasn't good):
- Left side (personal profile area): includes a circular avatar that slightly rotates on hover, a personalized large-type slogan, a dark frosted-glass quote card (wrapped in classic double quotation marks), and a social platform matrix;
- Right side (information board and navigation area): the horizontal width strictly matches the left card, achieving a rigorous geometric echo.
Right-side 6-grid system (grid-cols-6)
The right side needs to simultaneously accommodate two information boards (poetry, clock/weather) and six quick navigation items. We adopted an extremely neat 6-grid system:
- Upper half: 2 information cards each occupy 3 columns (sm:col-span-3,
3 + 3 = 6), splitting one row equally; - Lower half: quick navigation cards each occupy 2 columns (sm:col-span-2,
2 \times 3 = 6), neatly arranging 3 per row, 6 in total across two rows.
Rejecting bloated dependencies: tapping into the gesture-swipe potential of Nuxt UI Carousel
As the quick navigation items gradually became richer (divided into in-site feature sets and off-site social/homepage links), the cards began to exceed the comfortable capacity of a single screen. Intuitively, many developers would immediately pnpm install swiper The original project previously used swiper. Based on my tech stack, I switched to a different technology and chose to prioritize tapping into the built-in capabilities of the current tech stack (Nuxt UI). If I were using Reka UI as the project's UI library, I might use Swiper/Embla Carousel.
Why choose <UCarousel> instead of external Swiper?
- Zero extra dependencies and bundle size optimization: avoids introducing tens of KB of Swiper runtime and extra CSS for a simple set of navigation;
- Built on a first-class gesture engine: Nuxt UI's <UCarousel> is directly built on the famous **embla-carousel-vue**, with out-of-the-box touch swipe, mouse drag, damped physical inertia, and keyboard-accessible switching;
- Two-way data-driven indicator: we refactored the navPages pagination structure and bidirectionally bound the classic external capsule indicator bar with carousel events—when the user swipes with a finger or drags with the mouse, the indicator bar widens and highlights in real time via @select; when clicking the indicator dots, it calls carouselRef.value?.emblaApi?.scrollTo(index) to smoothly scroll to the corresponding page.
Real-world dynamic dashboards: clock, weather, and hydration time zones
- Clock ticking and SSR hydration defense:
- The poetry card supports click-to-cycle switching, while the clock card uses dayjs to format the date and combines it with @number-flow/vue to present mechanically textured smooth rolling digits.
- Critical boundary defense: since Nitro server-side rendering (SSR) is usually in UTC time while the client browser is in the local time zone, the time and weekday can easily trigger hydration mismatch errors. The clock area strictly uses <ClientOnly> wrapping and provides an elegant skeleton-screen fallback, converging time calculations on the client side (we stepped on this pitfall earlier in the project).
- Decoupling the weather API from local cache:
- City and temperature cannot rely on browser presets. We completely extracted them from the UI into app/Api/weather.ts;
- After the page mounts, it requests the user's geolocation, and once latitude and longitude are obtained, queries Open-Meteo for real-time temperature and weather conditions;
- 30-minute caching mechanism: weather data along with coordinates and timestamps is written to localStorage. Within half an hour, re-entering the page prioritizes reading the cache, avoiding repeated requests to the weather server due to frequent route switching; when the user refuses geolocation or the network is weak, it gracefully degrades to a status prompt (I didn't use VueQuery because, with so few APIs currently, there's absolutely no need to introduce a new dependency package to increase my mental burden and the post-bundle size).
- Multilingual path safety (useLocalePath):
- All in-site links use @nuxtjs/i18n's localePath for unified wrapping, ensuring that no matter whether the user clicks through in the Chinese or /en/ English environment, the multilingual context is never rudely flushed.
@click's boundaries
As the functionality approached completion, we went through two rounds of detailed debugging and exploration with typical engineering educational value:
@click.capture and @click in practice
When intercepting <NuxtLink> navigation to inject custom transition animations, the code used @click.capture.
- Principle analysis:.capture is the "capture phase" of the DOM event flow, intended to strike first when the event just enters the top level and intercept <NuxtLink>'s default route handling;
- Practical clarification: in testing, changing it to a normal @click behaved exactly the same. This is because the browser's "default navigation behavior" must wait until **the entire event flow (capture
\totarget\tobubble) has completely finished** before executing. As long as event.preventDefault() is called during the bubbling phase, the navigation can still be successfully stopped. In a clean structure where no child elements abuse stopPropagation, using the more semantically natural @click is sufficient.
The "door-opening" transition: DOM snapshot, unmount awareness, and flicker-free frame synchronization
The Visit button, avatar, and all in-site navigation are by no means just a simple router.push, but rather:the landing page slowly tears and slides apart to both sides along the central dividing line, revealing the main site ready behind the door.
This complex animation is unified in useEnter.ts, and behind it were three layers of core challenges:
[ 用户点击 Visit / 站内入口 ] │ ▼┌─────────────────────────────────────────────────────────────┐│ 1. 制造替身:克隆 sourcePage 并利用 50% 宽度裁剪成左右两扇门板 ││ 解决 NumberFlow 时钟克隆黑屏:克隆前用纯文本替换动态节点 │└─────────────────────────────────────────────────────────────┘ │ ▼┌─────────────────────────────────────────────────────────────┐│ 2. 门后暗流:发起 await navigateTo(to) ││ 启动 MutationObserver 监听 #__nuxt 深度节点增删 ││ 死等 !sourcePage.isConnected(旧页面彻底被 Vue 销毁离场) │ │└─────────────────────────────────────────────────────────────┘ │ ▼┌─────────────────────────────────────────────────────────────┐│ 3. 拒绝闪烁:await requestAnimationFrame 等待浏览器绘制完成一帧 , 在梅花生长动画里面也使用了这个处理,要做帧动画就需要这个方法│└─────────────────────────────────────────────────────────────┘ │ ▼┌─────────────────────────────────────────────────────────────┐│ 4. 气势拉开:左右门板执行 translateX(±100%) 滑动分离 ││ 动画完成,销毁 overlay 遮罩替身 │└─────────────────────────────────────────────────────────────┘1. Viewport clipping and NumberFlow snapshot fix
- We use fixed inset-0 z-[9999] to create a full-screen mask, use sourcePage.cloneNode(true) to fully copy the current viewport image, place it into two panel containers each occupying 50% width, and with overflow: hidden precisely clip out the left half and right half;
- Clock disappearance pitfall:@number-flow/vue is essentially an advanced component wrapping a Web Component native custom element (<number-flow>), shadow DOM. cloneNode cannot penetrate the clone, and the two are not in the same DOM tree. In the end, we maintained an H5 custom attribute so that the DOM tree reads this attribute when cloning to render the page (this should be the biggest pitfall, after all, it's a library several years old, so pitfalls are normal).
2. Why can't the animation be executed directly after navigateTo? (isConnected and MutationObserver)
- await navigateTo(to) only means the route-switching instruction has been issued; at this point Vue still needs to asynchronously load the new page's Chunk and execute setup.
- If the animation is executed directly, on the development server, at the instant the animation first starts, what you see will bethe old page pointlessly stalling for tens of milliseconds, or a momentary white screen flashing up, whereas the production server doesn't have this problem—but this also shows that the code is not robust;
- We use sourcePage.isConnected (a native browser DOM existence property) together with MutationObserver to recursively observe the #__nuxt root node ({ childList: true, subtree: true }).
- Only when !sourcePage.isConnected is detected (the old page is completely removed from the DOM tree and the new page is officially in place) does it let the Promise (resolve()) pass through
3. Eliminating white-screen flicker: requestAnimationFrame
Even after the old DOM is removed, in the browser's event loop mechanism,DOM changes (JS execution) do not equal pixels already being painted to the screen (style calculation, layout, and Paint are still needed).
Before opening the door, we added:
await new Promise(resolve => requestAnimationFrame(resolve))
forcibly yielding the main thread, waiting for the browser to steadily paint the new page's first frame to the GPU, and then elegantly pulling the door panels apart to the left and right. At this point, white screens and flicker are completely eliminated, and smoothness is maxed out. At the same time, combined with prefers-reduced-motion: reduce, when the user enables reduced motion, it automatically skips the door opening and switches instantly, balancing accessibility (requeAnimation was also used in the plum blossom growth animation, and the reduced-motion judgment was learned from GSAP's official docs).
Route migration and experience loop closure
After all animations, fault tolerance, and state machines passed rigorous verification, we completed the final "grafting":
- Root route swap: the original /shouping officially moved into the site root path /, and the original main-site stream page moved back to /home;
- Closed-loop interconnection: the landing page's Visit button, avatar, and "main site homepage" card smoothly enter /home through the double-door animation; and after entering the main site, clicking the avatar in the upper-left corner returns to the / facade;
- Environment verification: Nuxt prerendering, automatic multilingual path conversion, local SSR build, and full TypeScript type checking all concluded seamlessly with Exit status 0 and zero warnings.
I finished this shouping page and migrated it last night plus this afternoon. Today JOJO Steel Ball Run updated episode 2—let's see if I can make a golden-ratio animation 😶🌫️
Comments
No comments yet. Say something?