Skeleton 骨架屏
在加载期间显示内容的轮廓。
基础用法
通过 shape 和尺寸组合占位元素,使用 animated 开启动画。
查看代码收起代码
vue
<script setup lang="ts">
import { ZSkeleton } from '@codex-proxy/ui'
</script>
<template>
<div style="display: grid; gap: 12px">
<ZSkeleton shape="circle" style="width: 48px; height: 48px" />
<ZSkeleton shape="text" style="width: 160px" />
<ZSkeleton shape="text" style="width: 240px; max-width: 100%" />
</div>
</template>Skeleton API
属性
| 属性 | 说明 | 类型 | 默认值 |
|---|---|---|---|
as | 根元素标签 | keyof HTMLElementTagNameMap | 'span' |
shape | 占位形状,宽高由调用方设置 | 'text' | 'block' | 'circle' | 'block' |
animated | 播放加载动画,尊重减少动态效果设置 | boolean | true |