loading.d.ts 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import Vue, { VNodeDirective, PluginObject } 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. /** Class name of the custom spinner */
  15. spinner?: string
  16. /** Background color of the mask */
  17. background?: string
  18. /** Custom class name for Loading */
  19. customClass?: string
  20. }
  21. /** Loading Component */
  22. export declare class ElLoadingComponent extends Vue {
  23. /** Close the Loading instance */
  24. close (): void
  25. }
  26. /** Loading directive definition */
  27. export interface ElLoadingDirective extends VNodeDirective {
  28. name: 'loading',
  29. value: boolean,
  30. modifiers: {
  31. body: boolean,
  32. fullscreen: boolean
  33. }
  34. }
  35. /** Show animation while loading data */
  36. export interface ElLoading {
  37. /** Install Loading directive into Vue */
  38. install (vue: typeof Vue): void
  39. /** 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. */
  40. service (options: LoadingServiceOptions): ElLoadingComponent
  41. directive: PluginObject<never>
  42. }
  43. declare module 'vue/types/vue' {
  44. interface Vue {
  45. /** 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. */
  46. $loading (options: LoadingServiceOptions): ElLoadingComponent
  47. }
  48. }