先看效果图
element 中弹窗是支持自定义编译的,
如果你完整引入了 Element,它会为 Vue.prototype 添加如下全局方法:$msgbox, $alert, $confirm 和 $prompt。因此可以采用本页面中的方式调用 。
图片是静态资源这里放到static文件夹下。
设置参数注释写在代码里
this.$confirm(
'<strong> <img src="@/../static/img/cuo.png" alt="">'+
'<p>是否创建优惠劵模板</p></strong>',
'创建优惠劵模板', //弹窗标题
{
dangerouslyUseHTMLString: true,//true的时候message会被作为HTML片段处理
center:true, // 设置弹出框居中对齐
showCancelButton: true, //显示取消按钮
confirmButtonText: '确定',
cancelButtonText: '取消',
beforeClose: (action, instance, done) => {
if (action === 'confirm') { //点击确认
done();
window.history.go(-1)
}else{ //点击取消
done();
}
}
});
写在最后~ ~ 欢迎大家留言