index.d.ts 1.1 KB

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