dialog.d.ts 1.7 KB

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