添加聊天

This commit is contained in:
bobobobo
2025-12-30 23:28:59 +08:00
parent d0cf491201
commit 2294b3b76e
450 changed files with 37066 additions and 96 deletions

View File

@@ -0,0 +1,36 @@
import { TUIGlobal } from '@tencentcloud/universal-api';
import TOAST_TYPE from './type';
interface IToast {
message: string;
type?: string;
duration?: number;
}
const Toast = (options: IToast): void => {
TUIGlobal.showToast({
title: options.message || 'Toast',
duration: options.duration || 1500,
icon: handleIconType(options.type),
});
};
const handleIconType = (type: string | undefined) => {
if (!type) {
return 'none';
}
switch (type) {
case TOAST_TYPE.ERROR:
return 'none';
case TOAST_TYPE.WARNING:
return 'none';
case TOAST_TYPE.SUCCESS:
return 'success';
case TOAST_TYPE.NORMAL:
return 'none';
default:
return 'none';
}
};
export { Toast, TOAST_TYPE };

View File

@@ -0,0 +1,8 @@
const TOAST_TYPE = {
SUCCESS: 'success',
WARNING: 'warning',
ERROR: 'error',
NORMAL: 'normal',
};
export default TOAST_TYPE;