Loading Animation Component
This component is a small animation, currently used in Huayue's loadMore (load more) and other components for the loading state scenario.
📌 Platform Compatibility
| APP(vue) | H5 | WeChat Mini Program | Alipay Mini Program |
|---|---|---|---|
| ✔ | ✔ | ✔ | ✔ |
🏯 Basic Usage Examples
html
<!-- Global usage -->
<hy-loading></hy-loading>Animation Text
- Specify the text content via the
textprop - Specify the text size via the
textSizeprop
html
<template>
<hy-loading text="Loading..." textSize="18"></hy-loading>
</template>Mode Types
- Specify the mode via the
modepropspinnerpetal shape (default)circlering loading stylesemicirclehalf-circle loading styledotsbouncing dots loading stylebarssound wave bars loading style
html
<template>
<hy-loading mode="spinner"></hy-loading>
<hy-loading mode="circle"></hy-loading>
<hy-loading mode="semicircle"></hy-loading>
<hy-loading mode="dots"></hy-loading>
<hy-loading mode="bars"></hy-loading>
</template>Layout Types
- Specify whether the text and icon are arranged vertically via the
directionproprowloading icon and text arranged horizontallycolumnloading icon and text arranged vertically
html
<template>
<hy-loading text="Loading" direction="row"></hy-loading>
<hy-loading text="Loading" direction="column"></hy-loading>
</template>Animation Mode
timing-functionspecifies theanimation-timing-functionCSS property of the animation whenmodeissemicircleorcircle, defaulting toease-in-out
html
<template>
<hy-loading timing-function="linear"></hy-loading>
</template>Animation Duration
- Specify the animation cycle duration via the
durationprop
html
<template>
<hy-loading duration="2000"></hy-loading>
</template>Icon Color
- Specify the color of the animated active area via the
colorprop. - Specify the dark edge color when mode is circle via the
inactive-colorprop
html
<template>
<hy-loading color="red"></hy-loading>
<hy-loading mode="circle" color="red"></hy-loading>
</template>Icon Size
- Set the size via the
sizeprop, in px; the component applies the size value as its width and height
html
<template>
<hy-loading size="36"></hy-loading>
</template>API
Loading Props
| Prop | Description | Type | Default |
|---|---|---|---|
| show | Whether to show the animation | boolean | true |
| color | Icon color | string | - |
| textColor | Hint text color | string | #909399 |
| direction | Whether the icon and text are arranged vertically | column|row | row |
| mode | Mode selection[1] | spinner|circle|semicircle|dots |bars | spinner |
| size | Size of the loading icon, default unit px | string | number | 24 |
| textSize | Size of the loading text, default unit px | string | number | 15 |
| text | Text content | string | - |
| timingFunction | Specifies the animation-timing-function CSS property, only effective when mode is circle or semicircle | ease-in-out|ease-out| ease-in|linear|ease | ease-in-out |
| duration | Animation cycle duration, in ms | number | 1200 |
| inactiveColor | Dark edge color of the icon, only effective in circle mode | string | - |
| customStyle | Define external styles to be applied | string | - |
| customClass | Custom external class name | string | - |
spinner: petal shape;circle: circle;small: small size;semicircle: semicircle ↩︎

