Skeleton 骨架屏

在需要等待加载内容的位置提供一个占位图形组合

何时使用

  • 网络较慢需要长时间等待加载,且只在第一次加载的时候使用;
  • 在确保手机性能的前提下,尽量使用预加载,最好不用骨架屏;
  • 适用于图文信息较多且重要的首页、列表、卡片中,小的模块类组件(例如弹窗)不要使用;

代码示例

基本使用

属性

Skeleton

属性类型必填默认值说明
loadingboolean否true为 true 时,显示占位图。反之则直接展示子组件
animateboolean否flase是否展示动画效果
avatarstring否false是否显示头像占位图
titleboolean否true是否显示标题占位图
rowsnumber否3段落行数,大于0展示
avatarSizestring否'88rpx'头像大小
avatarShape'circle' | 'square'否'square'头像形状
classNamestring否-类名

Avatar 头像

属性类型必填默认值说明
loadingboolean否true为 true 时,显示占位图。反之则直接展示子组件
animateboolean否flase是否展示动画效果
sizestring否'88rpx'头像大小
shape'circle' | 'square'否'square'头像形状
classNamestring否-类名

Paragraph 段落

属性类型必填默认值说明
loadingboolean否true为 true 时,显示占位图。反之则直接展示子组件
animateboolean否flase是否展示动画效果
rowsnumber否3段落行数,大于0展示
classNamestring否-类名

Title 标题

属性类型必填默认值说明
loadingboolean否true为 true 时,显示占位图。反之则直接展示子组件
animateboolean否flase是否展示动画效果
classNamestring否-类名

Button 按钮

属性类型必填默认值说明
loadingboolean否true为 true 时,显示占位图。反之则直接展示子组件
animateboolean否flase是否展示动画效果
classNamestring否-类名

Input 输入框

属性类型必填默认值说明
loadingboolean否true为 true 时,显示占位图。反之则直接展示子组件
animateboolean否flase是否展示动画效果
classNamestring否-类名

Custom 自定义组件,添加标准容器和动画样式

属性类型必填默认值说明
loadingboolean否true为 true 时,显示占位图。反之则直接展示子组件
animateboolean否flase是否展示动画效果
classNamestring否-类名

样式类

类名说明
amd-skeleton整体样式
amd-skeleton-avatar头像样式
amd-skeleton-button按钮样式
amd-skeleton-paragraph段落样式
amd-skeleton-title标题样式
amd-skeleton-input输入框样式
amd-skeleton-custom自定义容器样式