Alert 警告提示

警告提示,展现需要关注的信息。

何时使用

  • 当某个页面需要向用户显示警告的信息时。
  • 非浮层的静态展现形式,始终展现,不会自动消失,用户可以点击关闭。

    代码演示

Warning text

Very long warning text warning text text text text text text text

Warning text without icon

Error text

顶部公告

页面顶部通告形式,默认有图标且type 为 'warning'。

Success Text

基本

最简单的用法,适用于简短的警告提示。

Warning Text Warning Text Warning TextW arning Text Warning Text Warning TextWarning Text
Error TextError Description Error Description Error Description Error Description Error Description Error Description

可关闭的警告提示

显示关闭按钮,点击可关闭警告提示。

Info TextClose Now

自定义关闭

可以自定义关闭,自定义的文字会替换原先的关闭 Icon

Success Text

Success Description Success Description Success Description

Info TextInfo Description Info Description Info Description Info Description
Warning TextWarning Description Warning Description Warning Description Warning Description
Error TextError Description Error Description Error Description Error Description

含有辅助性文字介绍

含有辅助性文字介绍的警告提示。

Success Tips
Informational Notes
Warning
Error
Success TipsDetailed description and advices about successful copywriting.
Informational NotesAdditional description and informations about copywriting.
WarningThis is a warning notice about copywriting.
ErrorThis is an error message about copywriting.

图标

可口的图标让信息类型更加醒目。

Success Text
Info Text
Warning Text
Error Text

四种样式

共有四种样式 successinfowarningerror

API

参数 说明 类型 默认值
afterClose 关闭动画结束后的回掉 () => void -
banner 是否用作顶部公告 boolean false
closable 默认不显示关闭按钮 boolean
closeText 自定义关闭按钮 string|slot
description 警告提示的辅助性文字介绍 string|slot
message 警告提示内容 string|slot
showIcon 是否显示辅助图标 boolean false,banner 模式下默认值为 true
iconType 自定义图标类型,showIcontrue 时有效 string -
type 指定警告提示的样式,有四种选择 successinfowarningerror string infobanner 模式下默认值为 warning

事件

事件名称 说明 回调参数
close 关闭时触发的回调函数 (e: MouseEvent) => void