logo
为了能更好地了解您的商业使用需求,请参与 Ant Design Blazor 商业应用调查,一起建设商业应用社区,为企业系统研发赋能!

Message全局提示

Examples

信息提醒反馈。

expand code expand code

自定义时长 10s,默认时长为 3s

expand code expand code

可以通过 Task 接口在关闭后运行 callback 。以上用例将在每个 message 将要结束时通过 ContinueWith 显示新的 message 。

expand code expand code

包括成功、失败、警告。

expand code expand code

进行全局 loading,异步自行移除。

expand code expand code

可以通过唯一的 key 来更新内容。

expand code expand code

Message API#

属性 描述 类型 默认值
Id 属性组件 HTML 的 ID String Uniquely Generated ID
Class 属性为 DOM 元素指定一个或多个类名。 String --
Style 属性指定 DOM 元素的内联样式。 String --
RefBack 属性一个 ForwardRef 实例。您可以使用 AntDesign.ForwardRef.Current 获取对内部 DOM 的引用。 ForwardRef --

IMessageService API#

方法签名 返回类型 描述
Config(MessageGlobalConfig config) void 配置全局消息选项
Destroy() void
Error(OneOf<String, RenderFragment, MessageConfig> content, Double? duration, Action onClose) Task 显示错误信息
Info(OneOf<String, RenderFragment, MessageConfig> content, Double? duration, Action onClose) Task 显示信息消息
Loading(OneOf<String, RenderFragment, MessageConfig> content, Double? duration, Action onClose) Task 显示加载消息
Open(MessageConfig config) Task 使用提供的配置打开消息
Success(OneOf<String, RenderFragment, MessageConfig> content, Double? duration, Action onClose) Task 显示成功信息
Warning(OneOf<String, RenderFragment, MessageConfig> content, Double? duration, Action onClose) Task 显示警告信息

MessageConfig API#

属性 描述 类型 默认值
Content 留言内容 OneOf<String, RenderFragment> --
Duration 自动关闭前的时间,以秒为单位 Double? --
Icon 消息图标 RenderFragment --
Key 组件的唯一标识符 String --
Type 留言风格 MessageType --
OnClose 在消息关闭时执行的回调 --
Drawer抽屉 Modal对话框
文档已更新,请点击 此处 更新。
A new version of this app is available. Click here to update.