fix: 调整服务支持页面渲染模式

- 将条件渲染由div判断改为el-skeleton template
This commit is contained in:
2025-12-19 11:38:33 +08:00
parent fa1a22b286
commit bcc08a53ea
3 changed files with 85 additions and 71 deletions

View File

@ -6,8 +6,22 @@
<h1 class="page-title">{{ $t('navigation.documents') }}</h1>
<app-breadcrumb class="breadcrumb" :items="breadcrumbItems" />
</div>
<div v-if="pending" class="page-content">
<el-skeleton :rows="10" animated class="py-4" throttle="100">
<div class="page-content">
<document-filter
v-model="filters"
:product-type-options="productTypeOptions"
:product-options="productOptions"
:document-type-options="documentTypeOptions"
/>
<el-skeleton
:loading="pending"
animated
:throttle="{
leading: 500,
trailing: 500,
}"
>
<template #template>
<div class="flex flex-col gap-xl">
<el-skeleton-item
@ -22,33 +36,26 @@
/>
</div>
</template>
<template #default>
<document-list
:documents="paginatedDocuments"
:show-category="
filters.selectedDocumentType === null ||
filters.selectedDocumentType === undefined
"
/>
<el-pagination
v-model:current-page="page"
class="justify-center pagination-container"
layout="prev, pager, next"
hide-on-single-page
:page-size="documentsPerPage"
:total="filteredDocuments.length"
/>
</template>
</el-skeleton>
</div>
<div v-else class="page-content">
<document-filter
v-model="filters"
:product-type-options="productTypeOptions"
:product-options="productOptions"
:document-type-options="documentTypeOptions"
/>
<document-list
:documents="paginatedDocuments"
:show-category="
filters.selectedDocumentType === null ||
filters.selectedDocumentType === undefined
"
/>
<el-pagination
v-model:current-page="page"
class="justify-center pagination-container"
layout="prev, pager, next"
hide-on-single-page
:page-size="documentsPerPage"
:total="filteredDocuments.length"
/>
</div>
</div>
</div>
</template>
@ -71,7 +78,9 @@
const page = ref(1);
const documentsPerPage = 10;
const { data: documents, pending, error } = useDocumentList();
const { data, pending, error } = useDocumentList();
const documents = computed(() => data.value ?? []);
const documentTypeOptions = computed(() => {
const types: DocumentTypeView[] = [];