微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

SweetAlert2

编程之家收集整理的这个编程导航主要介绍了SweetAlert2编程之家,现在分享给大家,也给大家做个参考。

SweetAlert2 介绍

SweetAlert2是一款功能强大的纯js模态消息对话框插件。SweetAlert2用于替代浏览器认的弹出对话框,它提供各种参数和方法支持嵌入图片,背景,html标签等,并提供5种内置的情景类,功能非常强大。 

安装

npm install --save sweetalert2

使用

Swal.fire({

title: 'Are you sure?',

text: 'You will not be able to recover this imaginary file!',

type: 'warning',

showCancelButton: true,

confirmButtonText: 'Yes,delete it!',

cancelButtonText: 'No,keep it'

}).then((result) => {

if (result.value) {

Swal.fire(

'Deleted!',

'Your imaginary file has been deleted.',

'success'

)

// For more @R_776_4045@ion about handling dismissals please visit

// https://sweetalert2.github.io/#handling-dismissals

} else if (result.dismiss === Swal.dismissReason.cancel) {

Swal.fire(

'Cancelled',

'Your imaginary file is safe :)',

'error'

)

}

})

 

网站地址:https://sweetalert2.github.io/

GitHub:https://github.com/sweetalert2/sweetalert2

网站描述:强大的纯Js模态消息对话框插件

SweetAlert2

官方网站:https://sweetalert2.github.io/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。