useLoader

Commons
stable

Resolves the polymorphic loading prop (boolean | number | TLoaderConfig) into a normalised descriptor used by the consuming component to mount the correct progress renderer (line, circular, or skeleton) with the correct props. Emits a BEM loading class while active.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

Interfaces consommées

ILoaderProps
IResolvedLoader

API

Paramètres

Paramètres d'entrée acceptés par ce composable.

props
requis
ILoaderProps
Component props extending ILoaderProps. The loading key accepts boolean (indeterminate), number (determinate 0-100), or a TLoaderConfig object with an explicit type discriminant.
defaultKind
TLoaderKind
LOADER_KIND.CIRCULAR
Renderer to use when loading is true or a plain number (no explicit type). Common values: 'circular' (Btn default), 'line' (Card default), 'skeleton'.
name
string
getCurrentInstanceName()
Kebab-case component name used to build the ${name}--loading BEM modifier class. Defaults to the current component name via getCurrentInstanceName().

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

isLoading
True when the loading prop is truthy (boolean true, a number, or a TLoaderConfig object).
loaderClasses
Class map to bind via :class. Contains { "${name}--loading": true } when isLoading is true.
loaderConfig
Normalised descriptor: isActive, kind (renderer type), modelValue (determinate progress), indeterminate flag, and overrides (per-kind props to v-bind on the renderer). Use this to conditionally mount OrigamProgress or OrigamSkeleton.

Usage

Exemples

Extraits de code prêts à coller.

Indeterminate circular loader

vue

Determinate line loader

vue