# Toast
类型更加丰富、兼容多端的 Toast
工具方法。
# 方法
import { Toast } from '@tencent/press-next/common/toast';
Toast.show(text);
Toast.showSuccess(text);
Toast.showFail(text);
Toast.showLoading(text);
Toast.dismissLoading();
# 类型
import Toast from '@tencent/press-ui/press-toast/index';
export type Options = string | {
message: string;
text?: string;
zIndex?: number;
duration?: number
forbidClick?: boolean;
};
export type ToastLoadingFunc = () => Array<Promise<{ default?: RawToast }>>;
export type Handler = (text: Options, duration?: number) => void;
export type IToast = {
(options: Options, duration?: number): void;
show: Handler;
showSuccess: Handler;
success: Handler;
showFail: Handler;
fail: Handler;
clear: () => void;
showLoading: (text: Options) => void;
loading: (text: Options) => void;
dismissLoading: () => void;
toastComponent: ToastLoadingFunc;
setComponent: (comp: ToastLoadingFunc) => void;
useCustomUI: () => void;
customUI?: boolean;
};
export type RawToast = typeof Toast;