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 informat ion about handling dis missals please visit
// https://sweetalert2.github.io/#handling- dis missals
} else if (result. dis miss === Swal. dis missReason.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/
如果觉得 网站内容还不错,欢迎将 网站 推荐给程序员好友。