UNPKG

1.96 kBTypeScriptView Raw
1import Vue, { VNodeDirective, PluginObject } from 'vue'
2
3/** Options used in Loading service */
4export interface LoadingServiceOptions {
5 /** The DOM node Loading needs to cover. Accepts a DOM object or a string. If it's a string, it will be passed to `document.querySelector` to get the corresponding DOM node */
6 target?: HTMLElement | string
7
8 /** Whether to make the mask append to the body element */
9 body?: boolean
10
11 /** Whether to show the loading mask in fullscreen */
12 fullscreen?: boolean
13
14 /** Whether to disable scrolling on body */
15 lock?: boolean
16
17 /** Loading text that displays under the spinner */
18 text?: string
19
20 /** Class name of the custom spinner */
21 spinner?: string
22
23 /** Background color of the mask */
24 background?: string
25
26 /** Custom class name for Loading */
27 customClass?: string
28}
29
30/** Loading Component */
31export declare class ElLoadingComponent extends Vue {
32 /** Close the Loading instance */
33 close (): void
34}
35
36/** Loading directive definition */
37export interface ElLoadingDirective extends VNodeDirective {
38 name: 'loading',
39 value: boolean,
40 modifiers: {
41 body: boolean,
42 fullscreen: boolean
43 }
44}
45
46/** Show animation while loading data */
47export interface ElLoading {
48 /** Install Loading directive into Vue */
49 install (vue: typeof Vue): void
50
51 /** If you do not have a specific DOM node to attach the Loading directive, or if you simply prefer not to use Loading as a directive, you can call this service with some configs to open a Loading instance. */
52 service (options: LoadingServiceOptions): ElLoadingComponent
53
54 directive: PluginObject<never>
55}
56
57declare module 'vue/types/vue' {
58 interface Vue {
59 /** If you do not have a specific DOM node to attach the Loading directive, or if you simply prefer not to use Loading as a directive, you can call this service with some configs to open a Loading instance. */
60 $loading (options: LoadingServiceOptions): ElLoadingComponent
61 }
62}