Skip to content

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播放加载动画,尊重减少动态效果设置booleantrue