UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

84 lines (83 loc) 2.07 kB
/** * 显示普通Toast * @param text 文案 * @param duration 显示时间,默认2秒 * @example * ```ts * Toast.show('文本', 3000); * ``` */ export declare const showToast: (text?: string, duration?: number) => void; /** * 显示成功样式Toast(toast带√样式) * @param text 文案 * @param duration 显示时间,默认2秒 * @example * ```ts * Toast.showSuccess('文本', 3000); * ``` */ export declare const showSuccess: (text?: string, duration?: number) => void; /** * 显示失败样式 Toast(toast带!样式) * @param text 文案 * @param duration 显示时间,默认2秒 * @example * ```ts * Toast.showFail('文本', 3000); * ``` */ export declare const showFail: (text?: string, duration?: number) => void; /** * 清除(隐藏)上一个toast * @example * ```ts * Toast.clear(); * * clearToast(); * ``` */ export declare const clearToast: () => void; /** * 显示loading Toast * @param {string | object} options 配置,传递字符串时候为message * @param {string} options.message 内容 * @param {number} options.duration 展示时长(ms),值为 0 时,toast 不会消失 * @param {boolean} options.forbidClick 是否禁止背景点击 * @param {string} options.selector 自定义选择器 * @example * ```ts * Toast.showLoading('文本'); * * Toast.showLoading({ * message: '文本', * zIndex: 1000, * }); * ``` */ export declare const showLoading: (options?: {}) => void; /** * 隐藏loading toast * @example * ```ts * Toast.dismissLoading(); * ``` */ export declare const dismissLoading: () => void; /** * Toast 对象 * @example * ```ts * Toast.show('文本') * ``` */ export declare const Toast: { show: (text?: string, duration?: number) => void; showToast: (text?: string, duration?: number) => void; showSuccess: (text?: string, duration?: number) => void; showFail: (text?: string, duration?: number) => void; clear: () => void; clearToast: () => void; showLoading: (options?: {}) => void; dismissLoading: () => void; };