index.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /// <reference types="miniprogram-api-typings" />
  2. /// <reference types="miniprogram-api-typings" />
  3. declare type Context = WechatMiniprogram.Page.TrivialInstance | WechatMiniprogram.Component.TrivialInstance;
  4. interface DialogAlertOptionsType {
  5. context?: Context;
  6. selector?: string;
  7. title?: string;
  8. content: string;
  9. zIndex?: number;
  10. asyncClose?: boolean;
  11. confirmButtonText?: string;
  12. textAlign?: string;
  13. cancelBtn?: string | object;
  14. confirmBtn?: string | object;
  15. }
  16. interface DialogComfirmOptionsType extends DialogAlertOptionsType {
  17. cancelButtonText?: string;
  18. }
  19. interface Action {
  20. name: string;
  21. primary?: boolean;
  22. style?: string;
  23. }
  24. interface DialogActionOptionsType {
  25. context?: Context;
  26. selector?: string;
  27. title?: string;
  28. content: string;
  29. zIndex?: number;
  30. asyncClose?: boolean;
  31. actions?: Action[];
  32. buttonLayout?: 'vertical' | 'horizontal';
  33. }
  34. declare const _default: {
  35. alert(options: DialogAlertOptionsType): Promise<unknown>;
  36. confirm(options: DialogComfirmOptionsType): Promise<unknown>;
  37. close(options: DialogComfirmOptionsType): Promise<void>;
  38. action(options: DialogActionOptionsType): Promise<{
  39. index: number;
  40. }>;
  41. };
  42. export default _default;