dialog.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. width?: string | number;
  8. zIndex?: number;
  9. context?: WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
  10. message?: string;
  11. overlay?: boolean;
  12. selector?: string;
  13. ariaLabel?: string;
  14. className?: string;
  15. customStyle?: string;
  16. transition?: string;
  17. asyncClose?: boolean;
  18. businessId?: number;
  19. sessionFrom?: string;
  20. overlayStyle?: string;
  21. appParameter?: string;
  22. messageAlign?: string;
  23. sendMessageImg?: string;
  24. showMessageCard?: boolean;
  25. sendMessagePath?: string;
  26. sendMessageTitle?: string;
  27. confirmButtonText?: string;
  28. cancelButtonText?: string;
  29. showConfirmButton?: boolean;
  30. showCancelButton?: boolean;
  31. closeOnClickOverlay?: boolean;
  32. confirmButtonOpenType?: string;
  33. };
  34. interface Dialog {
  35. (options: DialogOptions): Promise<DialogAction>;
  36. alert?: (options: DialogOptions) => Promise<DialogAction>;
  37. confirm?: (options: DialogOptions) => Promise<DialogAction>;
  38. close?: () => void;
  39. stopLoading?: () => void;
  40. install?: () => void;
  41. setDefaultOptions?: (options: DialogOptions) => void;
  42. resetDefaultOptions?: () => void;
  43. defaultOptions?: DialogOptions;
  44. currentOptions?: DialogOptions;
  45. }
  46. declare const Dialog: Dialog;
  47. export default Dialog;