CNCEC_APP/uni_modules/uview-pro/libs/function/toast.ts

15 lines
555 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 显示无图标的 Toast 提示
* @param title 提示文本
* @param option 显示时长毫秒默认1500 /显示图标默认为none
*/
function toast(title: string, option: number | string | Record<string, any> = 1500): void {
uni.showToast({
title: title,
icon: typeof option === 'string' ? option : typeof option === 'object' ? option.icon || 'none' : 'none',
duration: typeof option === 'number' ? option : typeof option === 'object' ? option.duration || '1500' : 1500
});
}
export default toast;