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