codecamp

React EasyUI 消息窗口

消息窗口( Messager )提供不同样式的消息窗口,如警示( alert )、确认( confirm )等。 消息窗口( Messager )都是异步的。用户可以在与消息窗口交互后使用回调函数以完成一些动作。

属性列表

名称 数据类型 作用描述 默认值
title string 消息标题。
msg string 要在对话框中显示的消息。
icon string 要在对话框上显示的图标类。
content function 呈现内容的函数。

方法列表

名称 参数 返回值 作用描述
alert options void 显示警告消息对话框。
confirm options void 显示确认消息对话框。
prompt options void 显示提示消息对话框。

  • alert方法代码实例:

this.messager.alert({
    title: "Info",
    icon: "info",
    msg: "Here is a info message!"
});

  • confirm方法代码实例:

this.messager.confirm({
    title: "Confirm",
    msg: "Are you confirm this?",
    result: r => {
      if (r) {
        alert("confirmed: " + r);
      }
    }
});

  • prompt方法代码实例:

this.messager.prompt({
    title: "Prompt",
    msg: "Please type something",
    result: r => {
      if (r) {
        alert("you type: " + r);
      }
    }
});

  • 参考图例

消息窗口

注:
- 继承: LocaleBase 。

React EasyUI 按钮组
React EasyUI 对话框
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

React EasyUI 教程总览

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }