toast.d.ts 1.2 KB

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