基础用法

消息提示弹框

```

点击打开 Message Boxexportdefault{    methods: {      open() {this.$alert('这是一段内容','标题名称', {          confirmButtonText:'确定',          callback: action => {this.$message({              type:'info',              message: `action: ${ action }`            });          }        });      }    }  }

点击打开 Message Boxexportdefault{ methods: { open() {this.$alert('这是一段内容','标题名称', { confirmButtonText:'确定', callback: action => {this.$message({ type:'info', message: `action: ${ action }` }); } }); } } } 点击打开 Message Boxexportdefault{ methods: { open() {this.$alert('这是一段内容','标题名称', { confirmButtonText:'确定', callback: action => {this.$message({ type:'info', message: `action: ${ action }` }); } }); } } }

点击打开 Message Box

export default {

methods: {

open() {

this.$alert('这是一段内容', '标题名称', {

confirmButtonText: '确定',

callback: action => {

this.$message({

type: 'info',

message: `action: ${ action }`

});

}

});

}

}

}

```

确认消息弹框

```

点击打开 Message Boxexportdefault{methods: {      open2() {this.$confirm('此操作将永久删除该文件, 是否继续?','提示', {confirmButtonText:'确定',cancelButtonText:'取消',type:'warning'}).then(() => {this.$message({            type:'success',            message:'删除成功!'});        }).catch(() => {this.$message({            type:'info',            message:'已取消删除'});                  });      }    }  }

点击打开 Message Box

export default {

methods: {

open2() {

this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {

confirmButtonText: '确定',

cancelButtonText: '取消',

type: 'warning'

}).then(() => {

this.$message({

type: 'success',

message: '删除成功!'

});

}).catch(() => {

this.$message({

type: 'info',

message: '已取消删除'

});

});

}

}

}

```

提交内容弹框

```

点击打开 Message Boxexportdefault{methods: {      open3() {this.$prompt('请输入邮箱','提示', {confirmButtonText:'确定',cancelButtonText:'取消',inputPattern:/[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,inputErrorMessage:'邮箱格式不正确'}).then(({ value }) => {this.$message({            type:'success',            message:'你的邮箱是: '+ value          });        }).catch(() => {this.$message({            type:'info',            message:'取消输入'});              });      }    }  }

点击打开 Message Box

export default {

methods: {

open3() {

this.$prompt('请输入邮箱', '提示', {

confirmButtonText: '确定',

cancelButtonText: '取消',

inputPattern: /[\w!#$%&'*+/=?^_`{|}~-]+(?:\.[\w!#$%&'*+/=?^_`{|}~-]+)*@(?:[\w](?:[\w-]*[\w])?\.)+[\w](?:[\w-]*[\w])?/,

inputErrorMessage: '邮箱格式不正确'

}).then(({ value }) => {

this.$message({

type: 'success',

message: '你的邮箱是: ' + value

});

}).catch(() => {

this.$message({

type: 'info',

message: '取消输入'

});

});

}

}

}

```

自定义弹框

```

点击打开 Message Boxexportdefault{methods: {      open4() {consth =this.$createElement;this.$msgbox({title:'消息',message: h('p',null, [            h('span',null,'内容可以是 '),            h('i', {style:'color: teal'},'VNode')          ]),showCancelButton:true,confirmButtonText:'确定',cancelButtonText:'取消',beforeClose:(action, instance, done)=>{if(action ==='confirm') {              instance.confirmButtonLoading =true;              instance.confirmButtonText ='执行中...';              setTimeout(() => {                done();                setTimeout(() => {                  instance.confirmButtonLoading =false;                },300);              },3000);            }else{done();            }          }        }).then(action => {this.$message({            type:'info',            message:'action: '+ action          });        });      }    }  }

点击打开 Message Box

export default {

methods: {

open4() {

const h = this.$createElement;

this.$msgbox({

title: '消息',

message: h('p', null, [

h('span', null, '内容可以是 '),

h('i', { style: 'color: teal' }, 'VNode')

]),

showCancelButton: true,

confirmButtonText: '确定',

cancelButtonText: '取消',

beforeClose: (action, instance, done) => {

if (action === 'confirm') {

instance.confirmButtonLoading = true;

instance.confirmButtonText = '执行中...';

setTimeout(() => {

done();

setTimeout(() => {

instance.confirmButtonLoading = false;

}, 300);

}, 3000);

} else {

done();

}

}

}).then(action => {

this.$message({

type: 'info',

message: 'action: ' + action

});

});

}

}

}

```

options:

参数类型说明可选值默认值

titleMessageBox 标题string——

messageMessageBox 消息正文内容string / VNode——

dangerouslyUseHTMLString是否将 message 属性作为 HTML 片段处理boolean—false

type消息类型,用于显示图标stringsuccess / info / warning / error—

customClassMessageBox 的自定义类名string——

callback若不使用 Promise,可以使用此参数指定 MessageBox 关闭后的回调function(action, instance),action 的值为’confirm’或’cancel’, instance 为 MessageBox 实例,可以通过它访问实例上的属性和方法——

showCloseMessageBox 是否显示右上角关闭按钮boolean—true

beforeCloseMessageBox 关闭前的回调,会暂停实例的关闭function(action, instance, done),action 的值为’confirm’或’cancel’;instance 为 MessageBox 实例,可以通过它访问实例上的属性和方法;done 用于关闭 MessageBox 实例——

lockScroll是否在 MessageBox 出现时将 body 滚动锁定boolean—true

showCancelButton是否显示取消按钮boolean—false(以 confirm 和 prompt 方式调用时为 true)

showConfirmButton是否显示确定按钮boolean—true

cancelButtonText取消按钮的文本内容string—取消

confirmButtonText确定按钮的文本内容string—确定

cancelButtonClass取消按钮的自定义类名string——

confirmButtonClass确定按钮的自定义类名string——

closeOnClickModal是否可通过点击遮罩关闭 MessageBoxboolean—true(以 alert 方式调用时为 false)

closeOnPressEscape是否可通过按下 ESC 键关闭 MessageBoxboolean—true(以 alert 方式调用时为 false)

closeOnHashChange是否在 hashchange 时关闭 MessageBoxboolean—true

showInput是否显示输入框boolean—false(以 prompt 方式调用时为 true)

inputPlaceholder输入框的占位符string——

inputType输入框的类型string—text

inputValue输入框的初始文本string——

inputPattern输入框的校验表达式regexp——

inputValidator输入框的校验函数。可以返回布尔值或字符串,若返回一个字符串, 则返回结果会被赋值给 inputErrorMessagefunction——

inputErrorMessage校验未通过时的提示文本string—输入的数据不合法!

center是否居中布局boolean—false

roundButton是否使用圆角按钮boolean—false

html c 中messagebox,Element-Ui组件 MessageBox 弹框相关推荐

  1. Element UI 组件库分析和二次开发(一)

    我的本地开发环境:M1 芯片Mac,node v12.22.10. 一.Element UI 组件库二次开发的大致流程 1. 从 Element 官方 clone 一份 dev 源码到本地 2. 安装 ...

  2. Element ui 组件中用键盘事件

    //这是表单 <el-form:model="ruleForm"status-icon:rules="rules"ref="ruleForm&q ...

  3. 【Vue.js】Vue.js中常用的UI组件库和Vue Router

    1.Vue生态中常用的UI组件库 1. vant 介绍 轻量级.可靠的移动端 Vue 组件库 有赞前端团队出品 GitHub地址:https://github.com/youzan/vant 特性 拥 ...

  4. Vue实现Element UI的下拉框默认选中,值来自父组件或异步获取

    子组件使用watch监听父组件传过来的值,并且赋值给子组件的data参数. 1.父组件传了一个userId属性给子组件 <Children@searchForm="searchForm ...

  5. php和ui,php项目中使用element.ui和vue

    1.plugins中添加axios,element-ui 2.全局文件下引入 3.页面内使用 1) 容器需要增加id属性 2) 添加script标签,创造vue组件 var app = new Vue ...

  6. vue中集成的ui组件库_Vue组件可使用Vault Flow通过Braintree集成PayPal付款

    vue中集成的ui组件库 Vue Braintree PayPal按钮 (Vue Braintree PayPal button) Vue component to integrate PayPal ...

  7. 使用element ui select下拉框多选,编辑状态下回显数据

    最近在做一个项目,项目的后端是地址:https://github.com/wangyuanjun008/wyj-springboot-security.git 前端地址是 https://github ...

  8. 1. 使用Popup组件自定义弹框提示页面

    Popup的基本使用 在QT中,经常使用QMessageBox进行弹框的提示,而在QML中并没有这个功能,但是可以利用Popup组件进行自定义弹框的设计. 该组件可以理解为是一个空白区域,默认的vis ...

  9. vue3 中使用antd UI组件

    之前搞pc端的 会使用element的ui组件 现在 vue3 来了  顺便也更新试用下 vuu3中的ui组件  不过好像 element还没更新支持  vue3  所以先用antd 来试试看 1. ...

  10. Element UI组件介绍

    简介 element ui 就是基于vue的一个ui框架,该框架基于vue开发了很多相关组件,方便我们快速开发页面. 1.安装Element UI,通过vue脚手架创建项 vue init webpa ...

最新文章

  1. php swiper 下拉刷新,SwipeRefreshLayout的使用(下拉刷新)
  2. 小度智能音箱维修点_会投屏电视的智能音箱——小度智能音箱PLAY青春版轻体验...
  3. java容器类继承_JAVA容器 - weslie - OSCHINA - 中文开源技术交流社区
  4. 使用Jquery提交Json格式的数据到Asp.net程序的另类做法
  5. 计算机专业师资描述,计算机专业师资队伍建设6主持建设优质核心课或教科研课题相关材料.doc...
  6. 【Itext】7步制作Itext5页眉页脚pdf实现第几页共几页
  7. [转]网站嵌入天气预报
  8. 如何使用jQuery刷新页面?
  9. matlab位姿,matlab位姿解算的相关问题,求助求助!
  10. 新车「智能化+安全」进入纵深区,艾拉比OTA成高频词
  11. 芯动科技面试——数字IC/FPGA面试案例总结1
  12. clock()、time()、clock_gettime()和gettimeofday()函数的用法和区别【转】
  13. 测试员如何面对30岁后的下坡路,伤不起的年龄,职业道路何去何从?
  14. 如何进入互联网行业,成为产品经理?没有项目经验如何转行当上产品经理?
  15. python treeview insert_pythonttkinter Treeview添加图像作为列值
  16. 匿名四轴地面站V4.5使用方法研究
  17. 非形式逻辑(02)类比推理
  18. 基于python的师生一体化学生信息管理系统——python期末设计!!!
  19. MDT ADK AIK
  20. Sage X3 ERP-PJM结构分解

热门文章

  1. 彩色图像、灰度图像、二值图像和索引图像区别
  2. Day01-C#学习:05、转义符号及算术运算符
  3. ISMAR 2020 | Mobile3DRecon 论文梳理
  4. Excel—LEFT、RIGHT、MID函数提取不同位置的字段
  5. 世界杯开幕,boss直聘被骂惨
  6. c++的学习——晶晶赴约会
  7. 每日简报 5月6日简报新鲜事 每天一分钟 了解新鲜事
  8. 游戏优化系列三:Unity游戏的黑屏问题解决方法
  9. 一文带你搞懂Go语言函数选项模式,Go函数一等公民。
  10. oracle rac 主备 轮训,oracle集群(RAC)和主备数据同步(DataGuard)思路