dialog.d.ts 1.8 KB

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