Skip to content

Loading Component

Loading Component

Loading component is used to display loading animations during page or element loading processes, providing fullscreen loading, area loading, and mini loading methods, with customizable text and styles.

Basic Usage

The most basic usage is to add loading effects to any element through the v-loading directive. The loading animation is displayed when the bound value is true.

Loading Text

You can add loading text to describe the ongoing operation by setting the loading-text attribute.

Custom Background

You can change the color of the loading mask by setting the background color, suitable for use on different backgrounds.

Fullscreen Loading

Fullscreen loading is used for the loading process of the entire page, used through API calls.

Mini Loading

Mini loading provides a lighter loading prompt, suitable for loading state display in small areas or lightweight operations.

Loading Component API

Directive Usage

DirectiveDescriptionTypeDefault
v-loadingWhether to show loading animationbooleanfalse

Directive Modifiers

Modifier NameDescription
loading-textLoading prompt text
loading-typeLoading animation type, options: bounce, spin
loading-backgroundLoading background color

API Methods

Method NameDescriptionParameters
fullLoading(options)Show fullscreen loadingoptions: LoadingOptionsType
miniLoading(options)Show mini loadingoptions: LoadingOptionsType

Options Type

typescript
interface LoadingOptionsType {
  text?: string; // Loading text
  bgColor?: string; // Background color, default is semi-transparent white
  model?: "ring" | "bean"; // Loading animation type
  delay?: number; // Delay display time (ms)
}

Style Variables

Loading component uses the following CSS variables, which can be customized through style overrides:

Variable NameDescriptionDefault Value
--t-loading-bg-colorLoading mask background colorrgba(255, 255, 255, 0.9)
--t-loading-text-colorLoading text color#606266
--t-loading-spinner-colorLoading icon color#1890ff

Released under the MIT License