loading.d.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import Vue, { VNodeDirective } from 'vue'
  2. /** Options used in Loading service */
  3. export interface LoadingServiceOptions {
  4. /** 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 */
  5. target: HTMLElement | string
  6. /** Whether to make the mask append to the body element */
  7. body?: boolean
  8. /** Whether to show the loading mask in fullscreen */
  9. fullscreen?: boolean
  10. /** Whether to disable scrolling on body */
  11. lock?: boolean
  12. /** Loading text that displays under the spinner */
  13. text?: string
  14. /** Custom class name for Loading */
  15. customClass?: string
  16. }
  17. /** Loading Component */
  18. export declare class ElLoadingComponent extends Vue {
  19. /** Close the Loading instance */
  20. close ()
  21. }
  22. /** Loading directive definition */
  23. export interface ElLoadingDirective extends VNodeDirective {
  24. name: 'loading',
  25. value: boolean,
  26. modifiers: {
  27. body: boolean,
  28. fullscreen: boolean
  29. }
  30. }
  31. /** Show animation while loading data */
  32. export interface ElLoading {
  33. /** Install Loading directive into Vue */
  34. install (vue: typeof Vue)
  35. /** 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. */
  36. service (options: LoadingServiceOptions): ElLoadingComponent
  37. }
  38. declare module 'vue/types/vue' {
  39. interface Vue {
  40. /** 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. */
  41. $loading (options: LoadingServiceOptions): ElLoadingComponent
  42. }
  43. }