Skip to content

Loading Animation Component ​

This component is a small animation, currently used in the loading state scenarios of Hy's loadMore (load more) and other components.

📌 Platform Differences ​

APP(vue)H5WeChat Mini ProgramAlipay Mini Program
✔✔✔✔

🏯 Basic Usage Example ​

html
<!-- Global usage -->
<hy-loading></hy-loading>

Animation Text ​

  • By configuring text, you can specify the text content
  • By configuring textSize, you can specify the text size
html
<template>
    <hy-loading text="Loading..." textSize="18"></hy-loading>
</template>

Mode Types ​

  • By configuring mode, you can specify the mode
    • spinner petal configuration (default)
    • circle ring loading style
    • semicircle semicircle loading style
    • dots bouncing dots loading style
    • bars sound 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>

Arrangement Types ​

  • By configuring direction, you can specify whether the text and icon are arranged vertically
    • row loading icon and text arranged horizontally
    • column loading 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-function can specify the animation-timing-function CSS property within the animation when mode is semicircle or circle, defaults to ease-in-out
html
<template>
    <hy-loading timing-function="linear"></hy-loading>
</template>

Animation Run Duration ​

  • By configuring duration, you can specify the run cycle time of the animation
html
<template>
    <hy-loading duration="2000"></hy-loading>
</template>

Icon Color ​

  • By configuring color, you can specify the color of the animation's active area.
  • By configuring inactive-color, you can specify the dark edge color when mode is circle
html
<template>
    <hy-loading color="red"></hy-loading>
    <hy-loading mode="circle" color="red"></hy-loading>
</template>

Icon Size ​

  • By configuring size, you can set the size in px; within the component, the size value is applied as the component's width and height
html
<template>
    <hy-loading size="36"></hy-loading>
</template>

API ​

Loading Props ​

ParameterDescriptionTypeDefault Value
showWhether to show the animationbooleantrue
colorIcon colorstring-
textColorPrompt text colorstring#909399
directionWhether the icon and text are arranged verticallycolumn|rowrow
modeMode selection[1]spinner|circle|semicircle|dots |barsspinner
sizeSize of the loading icon, numeric values default to pxstring | number24
textSizeSize of the loading text, numeric values default to pxstring | number15
textText contentstring-
timingFunctionSpecifies the animation-timing-function CSS property, but only effective when mode is circle or semicircleease-in-out|ease-out| ease-in|linear|easeease-in-out
durationAnimation execution cycle time, in msnumber1200
inactiveColorDark edge color of the icon, only effective when mode is circlestring-
customStyleDefine external styles to be usedstring-
customClassCustom external class namestring-

CSS Variables ​

Variable NameDescriptionDefault Value
--hy-loading-text-font-sizeText font size14px
--hy-loading-text-line-heightText line height20px
--hy-loading-border-widthRing border width3px
--hy-loading-bg-colorRing track color#e5e5e5
--hy-loading-dots-gapDot spacing6px
--hy-loading-bars-gapBar spacing3px
--hy-loading-vertical-text-colorVertically arranged text colorFollows --hy-text-color--grey
12:33
battery

  1. spinner: petal shape; circle: circle; small: small size; semicircle: semicircle ↩︎