feat(ui): replace text loading states with skeleton loaders
Add skeleton CSS classes to main.css for consistent loading UI Apply skeleton loading states to Admin, Habitat, Item, Pokemon, Recipe, and Auth views Improve perceived performance and accessibility during data fetching
This commit is contained in:
@@ -5,7 +5,7 @@ import DetailSection from '../components/DetailSection.vue';
|
||||
import EditMeta from '../components/EditMeta.vue';
|
||||
import EntityChips from '../components/EntityChips.vue';
|
||||
import PageHeader from '../components/PageHeader.vue';
|
||||
import StatusMessage from '../components/StatusMessage.vue';
|
||||
import Skeleton from '../components/Skeleton.vue';
|
||||
import { api, type RecipeDetail } from '../services/api';
|
||||
|
||||
const route = useRoute();
|
||||
@@ -17,7 +17,32 @@ onMounted(async () => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<StatusMessage v-if="!recipe" :duration="0">加载中</StatusMessage>
|
||||
<section v-if="!recipe" class="page-stack" aria-busy="true" aria-label="正在加载材料单详情">
|
||||
<div class="page-header page-header--skeleton" aria-hidden="true">
|
||||
<div class="page-header__copy">
|
||||
<Skeleton width="112px" />
|
||||
<Skeleton width="260px" height="46px" />
|
||||
<Skeleton width="128px" />
|
||||
<Skeleton width="300px" />
|
||||
</div>
|
||||
<div class="page-header__actions">
|
||||
<Skeleton variant="box" width="88px" height="36px" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="detail-grid" aria-hidden="true">
|
||||
<section v-for="index in 2" :key="index" class="detail-section skeleton-detail-section">
|
||||
<div class="detail-section__header">
|
||||
<Skeleton :width="index === 1 ? '92px' : '88px'" height="24px" />
|
||||
</div>
|
||||
<div class="detail-section__body">
|
||||
<div class="skeleton-chip-row">
|
||||
<Skeleton v-for="chipIndex in index === 1 ? 3 : 4" :key="chipIndex" width="82px" class="skeleton-chip" />
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</section>
|
||||
<section v-else class="page-stack">
|
||||
<PageHeader :title="recipe.name" subtitle="材料单详情">
|
||||
<template #kicker>Recipe Detail</template>
|
||||
|
||||
Reference in New Issue
Block a user