Skip to content

Skeleton

Grid Skeleton Screen

Construct a grid skeleton screen by combining multi-row and multi-column placeholder structures through row-col.

Theme Types

Set different skeleton themes through `theme`, commonly used for text, avatar, image, paragraph and other scenarios.

Cell Skeleton Screen

Can combine avatar, rectangle block and text lines to simulate common cell list layouts.

html
<view style="display: flex">
  <wd-skeleton :row-col="[{ size: '48px', type: 'circle' }]" />
  <wd-skeleton :custom-style="{ width: '100%', marginLeft: '12px' }" :row-col="[{ width: '50%' }, { width: '100%' }]" />
</view>

<view style="display: flex; margin-top: 20px">
  <wd-skeleton :row-col="[{ size: '48px', type: 'rect' }]" />
  <wd-skeleton :custom-style="{ width: '100%', marginLeft: '12px' }" :row-col="[{ width: '50%' }, { width: '100%' }]" />
</view>

Image Combination Skeleton Screen

Can combine row-col to customize image card and text-image mixed layout placeholder structures.

html
<wd-skeleton :row-col="[{ height: '171px' }, 1, { width: '107px' }, [{ width: '93px' }, { width: '32px', marginLeft: '41px' }]]" />
### Gradient Loading Animation
## Component Styles
Set `animation="gradient"` to enable gradient loading animation.
### Custom Rows and Columns

Customize the placeholder structure of each row through `row-col`, which can combine width, height, rounded corners, type and other configurations.
```html
<wd-skeleton :row-col="[{ width: '100%' }, { width: '80%' }, { width: '60%' }]" />
### Flashing Loading Animation

Set `animation="flashed"` to enable flashing loading animation.

```html
<view style="display: flex">
  <wd-skeleton :row-col="[{ size: '48px', type: 'circle' }]" />
  <wd-skeleton :custom-style="{ width: '100%', marginLeft: '12px' }" animation="flashed" theme="paragraph" />
</view>

Slot Content

Write actual content through the default slot. When loading is true, the skeleton screen is displayed; after switching to false, the slot content is displayed.

Animation Effects

Set animation to enable animation effects, optional values are gradient, flashed.

Custom Content

Set loading to false, then the default slot content is displayed.

html
<wd-skeleton :row-col="grid" :loading="showContent">
  <wd-grid>
    <wd-grid-item icon-size="32px" icon="picture" text="Text" />
    <wd-grid-item icon-size="32px" icon="picture" text="Text" />
    <wd-grid-item icon-size="32px" icon="picture" text="Text" />
    <wd-grid-item icon-size="32px" icon="picture" text="Text" />
    <wd-grid-item icon-size="32px" icon="picture" text="Text" />
  </wd-grid>
</wd-skeleton>
ts
const showContent = ref(true)

Attributes

ParameterDescriptionTypeDefault Value
themeSkeleton screen theme, optional values are text, avatar, paragraph, imageSkeletonTheme'text'
row-colCustomize placeholder configuration for each row, used to set the number of rows and columns, width, height, spacing, rounded corners and placeholder type, etc.SkeletonRowCol[][]
loadingWhether to display the skeleton screenbooleantrue
animationAnimation type, optional values are gradient, flashedSkeletonAnimation''
custom-classCustom style class namestring | string[] | Record<string, boolean>''
custom-styleCustom inline styleCSSProperties{}

Slots

NameDescription
defaultActual content displayed after loading ends

主题定制

CSS 变量

组件提供了下列 CSS 变量,可用于自定义样式,使用方法请参考 ConfigProvider 全局配置

名称默认值描述
--wot-skeleton-row-margin-bottom$spacing-loose行间距
--wot-skeleton-col-bg$filled-strong占位块背景色
--wot-skeleton-text-height$n-16文本占位高度
--wot-skeleton-rect-height$n-16矩形占位高度
--wot-skeleton-circle-height$n-48圆形占位尺寸
--wot-skeleton-text-border-radius$radius-small文本占位圆角
--wot-skeleton-rect-border-radius$radius-main矩形占位圆角
--wot-skeleton-circle-border-radius$radius-radius-full圆形占位圆角
--wot-skeleton-animation-gradient$filled-bottom渐变动画高亮色
--wot-skeleton-animation-flashed$filled-bottom闪烁动画高亮色
--wot-skeleton-animation-flashed-opacity$opacity-backdrop闪烁动画透明度

Source Code

Documentation
Component

Released under the MIT License.

Released under the MIT License.