跳到主要内容
Message
允许你向用户展示系统信息,你可以用来显示与用户界面上的某个字段无关的消息,例如技术错误,通常与用户操作没有关系。

示例

何时使用

  • 可提供成功、警告、错误等反馈信息
  • 视窗右上角落按顺序弹出、需要手动关闭
  • 系统主动推送

基本用法

点击按钮触发,可自定义内容与按钮功能

PCPhonePad
<page>
<actions>
<button bindclick="openAlertText('info')" text="默认通知"/>
<button bindclick="openAlertText('success')" text="成功通知"/>
<button bindclick="openAlertText('warning')" text="警告通知"/>
<button bindclick="openAlertText('error')" text="错误通知"/>
<button bindclick="openAlertText('success')" text="自定义按钮"/>
</actions>
</page>
export default XPage({
data: {},
openAlertText(type='error') {
let time = (new Date()).getTime();
CabinX.message({
title: '我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题我是标题',
text: '朕已经知道了朕已经知道了朕已经知道了朕已经知道了朕已经知道了朕已经知道了朕已经知道了朕已经知道了朕已经知道了朕已经知道了朕已经知道了朕已经知道了朕已经知道了' + time,
status: type,
ok: {
text: '知道了',
onClick: () => {

},
}
});
},
});


Attributes

参数说明类型可选值默认值版本
title弹框标题string----PC/Mobile--
text弹框标题string----PC/Mobile--
status状态stringinfo / success / warning / errorinfoPC/Mobile--
ok按钮object,参考OK属性说明----PC/Mobile--

ok

参数说明类型可选值默认值
text按钮文案string----
onClick点击回调函数function----

使用

let instance=CabinX.message({
title: '我是标题',
text: '朕已经知道了',
status: 'success',
ok: {
text: '知道了',
onClick: () => {

},

}
});

//更新
instance.update({
text:'修改了'
});