Skip to content

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)H5WeChat Mini ProgramAlipay Mini Program

🏯 Basic Usage Examples

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

Animation Text

  • Specify the text content via the text prop
  • Specify the text size via the textSize prop
html
<template>
    <hy-loading text="Loading..." textSize="18"></hy-loading>
</template>

Mode Types

  • Specify the mode via the mode prop
    • spinner petal shape (default)
    • circle ring loading style
    • semicircle half-circle 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>

Layout Types

  • Specify whether the text and icon are arranged vertically via the direction prop
    • 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 specifies the animation-timing-function CSS property of the animation when mode is semicircle or circle, defaulting to ease-in-out
html
<template>
    <hy-loading timing-function="linear"></hy-loading>
</template>

Animation Duration

  • Specify the animation cycle duration via the duration prop
html
<template>
    <hy-loading duration="2000"></hy-loading>
</template>

Icon Color

  • Specify the color of the animated active area via the color prop.
  • Specify the dark edge color when mode is circle via the inactive-color prop
html
<template>
    <hy-loading color="red"></hy-loading>
    <hy-loading mode="circle" color="red"></hy-loading>
</template>

Icon Size

  • Set the size via the size prop, 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

PropDescriptionTypeDefault
showWhether to show the animationbooleantrue
colorIcon colorstring-
textColorHint 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, default unit pxstring | number24
textSizeSize of the loading text, default unit pxstring | number15
textText contentstring-
timingFunctionSpecifies the animation-timing-function CSS property, only effective when mode is circle or semicircleease-in-out|ease-out| ease-in|linear|easeease-in-out
durationAnimation cycle duration, in msnumber1200
inactiveColorDark edge color of the icon, only effective in circle modestring-
customStyleDefine external styles to be appliedstring-
customClassCustom external class namestring-
03:29

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