Skip to content

EMessage 消息提示 ​

import EUI 1.0

示例与代码 ​

消息提示 ​

QML 代码QML
效果
运行代码,体验组件交互

可修改文字、属性和事件,再点击运行。

代码在当前浏览器中运行 许可

属性 ​

属性说明取值与默认值
appendToItem

浮层挂载的目标对象。

默认值null
backgroundColorcolor

背景颜色。

默认值动态绑定
callbacksvar

按消息键保存的操作回调;由消息生命周期维护。

默认值({})
centerbool

是否采用居中布局或居中文字。

默认值false
clearingbool

消息管理器正在清理全部消息的状态。

默认值false
closeOnClickbool

点击消息或通知时关闭。

默认值false
dangerouslyUseHTMLStringbool

按富文本解释内容;仅应对可信内容启用。

默认值false
durationint

消息自动关闭的等待时间,单位为毫秒。

0:不自动关闭
正数:延迟毫秒数

默认值EControlConfig.optionFor(control, "message", "duration", 3000)
enabledbool

是否允许交互;false 时控件禁用。

默认值true
groupingbool

将相同内容的消息或通知合并。

默认值继承 Provider,默认 false
heightreal

组件尺寸,单位为像素;可绑定父布局尺寸。

默认值implicitHeight
iconSourceint

组件使用的图标。

EIcons.*
0(无图标)

默认值0
maxint

同时显示的消息上限。

0:不限制
正数:限制值

默认值EControlConfig.optionFor(control, "message", "max", 0)
offsetreal

消息栈距窗口边缘的起始偏移,单位为像素。

默认值EControlConfig.optionFor(control, "message", "offset", 10)
pauseOnHoverbool

鼠标悬停时暂停自动切换或关闭计时。

默认值true
pendingRemovalKeysvar

等待退场动画完成后移除的消息键数组。

默认值[]
placementint

消息在窗口中的显示位置。

EPlacement.TopLeft
EPlacement.Top
EPlacement.TopRight
EPlacement.Left
EPlacement.Center
EPlacement.Right
EPlacement.BottomLeft
EPlacement.Bottom
EPlacement.BottomRight

默认值EControlConfig.optionFor(control, "message", "placement", EPlacement.Top)
plainbool

采用朴素配色。

默认值继承 Provider,默认 false
repeatNumint

消息重复次数。

默认值1
showClosebool

是否显示关闭或删除按钮。

默认值继承 Provider,默认 true
showIconbool

是否显示语义状态图标。

默认值false
styleTypeint

语义配色风格。

EStyle.Default
EStyle.Primary
EStyle.Success
EStyle.Info
EStyle.Warning
EStyle.Danger

默认值EStyle.Primary
textColorcolor

文字颜色。

默认值动态绑定
typeint

消息的语义类型,默认使用 styleType。

EStyle.Default
EStyle.Primary
EStyle.Success
EStyle.Info
EStyle.Warning
EStyle.Danger

默认值EStyle.Default
visiblebool

是否显示组件。

默认值true
widthreal

组件尺寸,单位为像素;可绑定父布局尺寸。

默认值implicitWidth
countint只读

骨架实例数量或当前项目数量,具体含义由组件决定。

默认值由运行时计算

信号 ​

签名作用
closed(string key)

消息关闭时触发,key 为消息标识。

opened(string key)

消息显示时触发,key 为消息标识。

clicked(string key)

点击消息时触发,key 为消息标识。

方法 ​

签名作用
closeAll(type)

关闭全部消息;传入 type 时只关闭对应类型。

close(key)

关闭 key 对应的消息。

clear(type)

关闭消息;传入 type 时只处理该类型的消息。

open(message, key, duration)

显示 message 指定的消息内容或配置,key 为可省略的消息标识,duration 为显示时长(毫秒);返回消息标识。

基于 MIT 许可发布 · 第三方资源遵循其各自许可