Skip to content

介绍


本文档主要用于描述 ShadcnSkeleton 组件的一些特性和用法。

用法

查看代码
vue
<template>
    <ShadcnSkeleton />
</template>

<script setup lang="ts">
</script>

动画 (animation)

查看代码
vue
<template>
    <ShadcnSkeleton animation />
</template>

<script setup lang="ts">
</script>

排版 (paragraph)

查看代码
vue
<template>
    <ShadcnSkeleton :paragraph=" { rows: 5, width: [100, 200, '300px', '50%', '62%'] }"/>
</template>

<script setup lang="ts">
</script>

类型 (type)

查看代码
vue
<template>
    <ShadcnSkeletonItem animation type="circle"/>
    <ShadcnSkeletonItem animation type="square"/>
    <ShadcnSkeletonItem animation type="rect"/>
    <ShadcnSkeletonItem animation type="image"/>
</template>

<script setup lang="ts">
</script>

尺寸 (size)

查看代码
vue
<template>
    <ShadcnSkeletonItem animation type="image" size="small"/>
    <ShadcnSkeletonItem animation type="image" size="default"/>
    <ShadcnSkeletonItem animation type="image" size="large"/>
</template>

<script setup lang="ts">
</script>

液态玻璃效果 (glass)

查看代码
vue
<template>
    <div :class="['p-8 rounded-lg', 'bg-gradient-to-r from-purple-400 to-pink-400']">
        <div :class="['p-6 rounded-lg space-y-6', 'bg-white/50']">
            <div>
                <h4 class="text-sm font-medium mb-3 text-gray-700">基础骨架屏</h4>
                <ShadcnSkeleton glass />
            </div>
            <div>
                <h4 class="text-sm font-medium mb-3 text-gray-700">带动画效果</h4>
                <ShadcnSkeleton glass animation />
            </div>
            <div>
                <h4 class="text-sm font-medium mb-3 text-gray-700">不同形状</h4>
                <div class="flex gap-4 items-center">
                    <ShadcnSkeletonItem type="circle" size="large" glass />
                    <ShadcnSkeletonItem type="square" size="large" glass />
                    <ShadcnSkeletonItem type="rect" width="200px" size="large" glass />
                </div>
            </div>
            <div>
                <h4 class="text-sm font-medium mb-3 text-gray-700">图片骨架屏</h4>
                <ShadcnSkeletonItem type="image" size="large" glass animation />
            </div>
        </div>
    </div>
</template>

<script setup lang="ts">
</script>

骨架屏 (Skeleton) 属性

骨架屏节点 (Skeleton Item) 属性

骨架屏 (Skeleton) 插槽