Commit 69d9be3e3c

69d9be3e3cd89036cb8869d0db42f0d27373b316

parent: 7d8eb83685

Unsigned

Duck <57977673+woducku@users.noreply.github.com> · 2026-06-24 08:21 UTC

Update HomeFeatures.vue

Layout: unified · split

docs/.vitepress/theme/components/HomeFeatures.vue +18 −3
@@ -1,5 +1,5 @@
1<script setup lang="ts"> 1<script setup lang="ts">
2import { computed, ref, watch } from 'vue' 2import { computed, onMounted, ref, watch } from 'vue'
3import type { HomeCard } from '../../configs/constants' 3import type { HomeCard } from '../../configs/constants'
4 4
5const props = defineProps<{ cards: HomeCard[] }>() 5const props = defineProps<{ cards: HomeCard[] }>()
@@ -28,7 +28,13 @@ function loadState(): CardState {
28 } catch { return defaultState() } 28 } catch { return defaultState() }
29} 29}
30 30
31const state = ref<CardState>(loadState()) 31const mounted = ref(false)
32const state = ref<CardState>(defaultState())
33
34onMounted(() => {
35 state.value = loadState()
36 mounted.value = true
37})
32 38
33function save() { 39function save() {
34 localStorage.setItem(STORAGE_KEY, JSON.stringify(state.value)) 40 localStorage.setItem(STORAGE_KEY, JSON.stringify(state.value))
@@ -198,7 +204,7 @@ function onHandlePointerUp() {
198 204
199<template> 205<template>
200 <!-- ── Feature Grid ── --> 206 <!-- ── Feature Grid ── -->
201 <div class="home-features"> 207 <div class="home-features" :class="{ 'is-mounted': mounted }">
202 <div class="container"> 208 <div class="container">
203 <div class="card-toolbar"> 209 <div class="card-toolbar">
204 <button class="gear-btn" aria-label="Customize cards" @click="panelOpen = true"> 210 <button class="gear-btn" aria-label="Customize cards" @click="panelOpen = true">
@@ -379,6 +385,15 @@ function onHandlePointerUp() {
379 padding: 0 24px; 385 padding: 0 24px;
380} 386}
381 387
388.home-features .container {
389 opacity: 0;
390 transition: opacity 0.15s ease;
391}
392
393.home-features.is-mounted .container {
394 opacity: 1;
395}
396
382@media (min-width: 640px) { 397@media (min-width: 640px) {
383 .home-features { padding: 0 48px; } 398 .home-features { padding: 0 48px; }
384} 399}