Files
CRM_Montzar/apps/web/src/components/skeleton/CrmSkeletonList.vue
T

32 lines
793 B
Vue
Raw Normal View History

<script setup lang="ts">
import { toRef } from 'vue';
import { Flex as AFlex, Skeleton as ASkeleton, theme } from 'ant-design-vue';
import { useCrmSkeletonLoading } from './context';
const props = withDefaults(
defineProps<{
loading?: boolean;
rows?: number;
avatar?: boolean;
}>(),
{ rows: 6, avatar: true },
);
const { token } = theme.useToken();
const isLoading = useCrmSkeletonLoading(toRef(props, 'loading'));
</script>
<template>
<a-flex v-if="isLoading" vertical :gap="token.paddingSM">
<a-skeleton
v-for="i in rows"
:key="i"
active
:avatar="avatar ? { size: token.controlHeight, shape: 'circle' } : false"
:title="{ width: '40%' }"
:paragraph="{ rows: 1, width: ['70%'] }"
/>
</a-flex>
<slot v-else />
</template>