Skip to content

Commit 8982c3e

Browse files
committed
feat: add skeleton loader for the afcl table with backend pagination
1 parent 486b372 commit 8982c3e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

adminforth/spa/src/afcl/Table.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,14 @@
3131
:item="item" :column="column"
3232
>
3333
</slot>
34-
<span v-else>
34+
<span v-else-if="!isLoading" >
3535
{{ item[column.fieldName] }}
3636
</span>
37+
<div v-else>
38+
<div class="h-5 w-full">
39+
<Skeleton class="h-4" />
40+
</div>
41+
</div>
3742
</td>
3843
</tr>
3944
</tbody>
@@ -75,7 +80,7 @@
7580
<script setup lang="ts">
7681
import { ref, type Ref, computed } from 'vue';
7782
import { asyncComputed } from '@vueuse/core';
78-
import { IconArrowRightOutline, IconArrowLeftOutline } from '@iconify-prerendered/vue-flowbite';
83+
import { Skeleton } from '@/afcl';
7984
8085
const props = withDefaults(
8186
defineProps<{
@@ -95,10 +100,14 @@
95100
);
96101
97102
const currentPage = ref(1);
103+
const isLoading = ref(false);
98104
99105
const dataResult = asyncComputed( async() => {
100106
if (typeof props.data === 'function') {
101-
return await props.data(currentPage.value, props.pageSize);
107+
isLoading.value = true;
108+
const result = await props.data(currentPage.value, props.pageSize);
109+
isLoading.value = false;
110+
return result;
102111
}
103112
const start = (currentPage.value - 1) * props.pageSize;
104113
const end = start + props.pageSize;

0 commit comments

Comments
 (0)