dialog.d.ts 1.6KB

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