跳到主要内容

Alert 警告提示

用于页面中展示重要的提示信息。

来源: 直接从 antd 重新导出。完整文档:Ant Design Alert

基础用法

import { Alert } from '@vef-framework-react/components';

export default function Demo() {
return <Alert message="成功提示" type="success" />;
}

四种类型

import { Alert, Space } from '@vef-framework-react/components';

export default function Demo() {
return (
<Space direction="vertical" style={{ width: '100%' }}>
<Alert message="消息提示" type="info" />
<Alert message="成功提示" type="success" />
<Alert message="警告提示" type="warning" />
<Alert message="错误提示" type="error" />
</Space>
);
}

带描述

<Alert
message="警告"
description="此操作可能影响其他用户。"
type="warning"
showIcon
closable
/>

API

属性类型默认值说明
messageReactNode警告提示内容
descriptionReactNode警告提示的辅助性文字介绍
type'success' | 'info' | 'warning' | 'error''info'指定警告提示的样式
showIconbooleanfalse是否显示辅助图标
closablebooleanfalse是否可关闭
onClose(e) => void关闭时触发的回调函数
bannerbooleanfalse是否用作顶部公告
actionReactNode自定义操作项