浮动消息
通过 JS 动态创建一个浮动消息。
基本用法
通过构造一个 messager 实例,页面上创建一个浮动消息。
显示位置
提供 9 个预设的显示位置,通过 placement 选项进行指定。
颜色主题
提供多种预设颜色主题,通过 type 选项指定外观工具类即可。
禁用关闭按钮
默认会在右侧显示关闭按钮,如果需要禁用关闭按钮,将 close 选项设置为 false。
自定义操作按钮
通过 actions 数组来自定义一组操作。详细配置可参考 工具栏。
禁用自动隐藏
默认超过 5000ms 自动隐藏,通过设置 time 为 0 取消自动隐藏。
禁用动画效果
设置 animation 为 false 禁用动画效果。
选项
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
type | string | null | 消息类型 |
placement | string | null | 浮动消息定位方式,支持 'top' | 'center' | 'bottom' | 'left-top' | 'left' | 'left-bottom' | 'right' | 'right-top' | 'right-bottom' |
time | number | null | 浮动消息持续时间 |
content | string | null | 浮动消息内容 |
message | string | null | 浮动消息内容,等同于 content |
icon | string | null | 图标名称 |
actions | object[] | null | 操作按钮定义列表 |
margin | number | null | 外边距 |