html c 中messagebox,Element MessageBox弹框的具体使用

组件—弹框

消息提示

7b0b148ffb659700b776e51fa8faae6a.png

55ac978bdea0ec80c09fa6f3220e5d49.png

点击打开 Message Box

export default {

methods: {

open() {

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

confirmButtonText: '确定',

callback: action => {

this.$message({

type: 'info',

message: `action: ${ action }`

});

}

});

}

}

}

确认消息

a754d8ac80290339bed4c0b77ee9bc10.png

18c29867aa97ac1bae64d8e44e5a57e9.png

点击打开 Message Box

export default {

methods: {

open() {

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

confirmButtonText: '确定',

callback: action => {

this.$message({

type: 'info',

message: `action: ${ action }`

});

}

});

}

}

}

提交内容

0052f0f8f7d46c62c5d9d5ccb8713f44.png

301f83eb92984ffbf842b1c11839d9a3.png

点击打开 Message Box

export default {

methods: {

open() {

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: '取消输入'

});

});

}

}

}

自定义

dea083029b352b9baba85df83052f7a4.png

a3bb29fddddf1816fbeb2e9ba534eef1.png

点击打开 Message Box

export default {

methods: {

open() {

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

});

});

}

}

}

使用 HTML 片段

76203fd55619062a74850d74ee86392a.png

26293ebc39f6f2d31c32a83aef21afa8.png

点击打开 Message Box

export default {

methods: {

open() {

this.$alert('这是 HTML 片段', 'HTML 片段', {

dangerouslyUseHTMLString: true

});

}

}

}

区分取消与关闭

eea0dcc79a41fd591c12453ff7b20073.png

508bffe59290d85633a8fe98651a5cfa.png

点击打开 Message Box

export default {

methods: {

open() {

this.$alert('这是 HTML 片段', 'HTML 片段', {

dangerouslyUseHTMLString: true

});

}

}

}

居中布局

f19b7775007d703c7d8417ed5a72de2e.png

22682e3777d74d9ca51e39ed8f47ca4b.png

点击打开 Message Box

export default {

methods: {

open() {

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

confirmButtonText: '确定',

cancelButtonText: '取消',

type: 'warning',

center: true

}).then(() => {

this.$message({

type: 'success',

message: '删除成功!'

});

}).catch(() => {

this.$message({

type: 'info',

message: '已取消删除'

});

});

}

}

}

全局方法

ad4d1517278a81eae8a05585a093c5c4.png

单独引用

e3cc9ebd69b0a353ae4ac6cce2c6f298.png

Options

a55b4f07ac4520e4759033f51dc23a79.png

d73af6b91bd77395754baadad5a4de7d.png

6ebefba420b067c0f6af6704ab995755.png

63694b99cda2e559357113c69b150b3d.png

到此这篇关于Element MessageBox弹框的具体使用的文章就介绍到这了,更多相关Element MessageBox弹框内容请搜索脚本之家以前的文章或继续浏览下面的相关文章希望大家以后多多支持脚本之家!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值