dialog.d.ts 1.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /// <reference types="miniprogram-api-typings" />
  2. declare type DialogAction = 'confirm' | 'cancel';
  3. declare type DialogOptions = {
  4. lang?: string;
  5. show?: boolean;
  6. title?: string;
  7. zIndex?: number;
  8. context?: WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
  9. message?: string;
  10. overlay?: boolean;
  11. selector?: string;
  12. ariaLabel?: string;
  13. className?: string;
  14. customStyle?: string;
  15. transition?: string;
  16. asyncClose?: boolean;
  17. businessId?: number;
  18. sessionFrom?: string;
  19. appParameter?: string;
  20. messageAlign?: string;
  21. sendMessageImg?: string;
  22. showMessageCard?: boolean;
  23. sendMessagePath?: string;
  24. sendMessageTitle?: string;
  25. confirmButtonText?: string;
  26. cancelButtonText?: string;
  27. showConfirmButton?: boolean;
  28. showCancelButton?: boolean;
  29. closeOnClickOverlay?: boolean;
  30. confirmButtonOpenType?: string;
  31. };
  32. interface Dialog {
  33. (options: DialogOptions): Promise<DialogAction>;
  34. alert?: (options: DialogOptions) => Promise<DialogAction>;
  35. confirm?: (options: DialogOptions) => Promise<DialogAction>;
  36. close?: () => void;
  37. stopLoading?: () => void;
  38. install?: () => void;
  39. setDefaultOptions?: (options: DialogOptions) => void;
  40. resetDefaultOptions?: () => void;
  41. defaultOptions?: DialogOptions;
  42. currentOptions?: DialogOptions;
  43. }
  44. declare const Dialog: Dialog;
  45. export default Dialog;