toast.d.ts 1.1 KB

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