toast.d.ts 1.2KB

123456789101112131415161718192021222324252627
  1. /// <reference types="miniprogram-api-typings" />
  2. declare type ToastMessage = string | number;
  3. interface ToastOptions {
  4. show?: boolean;
  5. type?: string;
  6. mask?: boolean;
  7. zIndex?: number;
  8. context?: WechatMiniprogram.Component.TrivialInstance | WechatMiniprogram.Page.TrivialInstance;
  9. position?: string;
  10. duration?: number;
  11. selector?: string;
  12. forbidClick?: boolean;
  13. loadingType?: string;
  14. message?: ToastMessage;
  15. onClose?: () => void;
  16. }
  17. declare function Toast(toastOptions: ToastOptions | ToastMessage): WechatMiniprogram.Component.TrivialInstance;
  18. declare namespace Toast {
  19. var loading: (options: string | number | ToastOptions) => WechatMiniprogram.Component.Instance<Record<string, any>, Record<string, any>, Record<string, any>>;
  20. var success: (options: string | number | ToastOptions) => WechatMiniprogram.Component.Instance<Record<string, any>, Record<string, any>, Record<string, any>>;
  21. var fail: (options: string | number | ToastOptions) => WechatMiniprogram.Component.Instance<Record<string, any>, Record<string, any>, Record<string, any>>;
  22. var clear: () => void;
  23. var setDefaultOptions: (options: ToastOptions) => void;
  24. var resetDefaultOptions: () => void;
  25. }
  26. export default Toast;