SweetAlert2

编程之家收集整理的这个编程导航主要介绍了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 information 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/

如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。

相关文章

scalable.js,一款可以使任何HTML元素动态缩放适合父元素的js...
Pica,使用JS进行快速高品质图像缩放
react-dates,React 日期组件
date-fns,轻量级的JavaScript 日期工具库
WOW.js,一款效果炫酷的元素在页面滚动时展示CSS3动画的JS插件
Pikaday,一个 轻量级、无依耐Js日期选择器