SweetAlert2

参考

1.1、SweetAlert2简介
是什么 ?:a beautiful, responsive, highly customizable and accessible (WAI-ARIA) replacement for JavaScript's popup boxes. Zero dependencies.
开发语言:JavaScript
官方主页:https://sweetalert2.github.io
源码仓库:https://github.com/sweetalert2/sweetalert2

SweetAlert2SweetAlert的升级版本,在SweetAlert的基础上增加了一些功能,更加强大了。

1.2、通过开源CDN引入SweetAlert2

jsDelivr    

<link  href="https://cdn.jsdelivr.net/npm/sweetalert2@9.10.12/dist/sweetalert2.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@9.10.12/dist/sweetalert2.min.js" type="text/javascript"></script>
<!-- for IE support -->
<script src="https://cdn.jsdelivr.net/npm/es6-promise@4.2.8/dist/es6-promise.min.js" type="text/javascript"></script>

BootCDN    

<link  href="https://cdn.bootcdn.net/ajax/libs/limonte-sweetalert2/8.11.8/sweetalert2.min.css" rel="stylesheet">
<script src="https://cdn.bootcdn.net/ajax/libs/limonte-sweetalert2/8.11.8/sweetalert2.min.js" type="text/javascript"></script>
<!-- for IE support -->
<script src="https://cdn.bootcdn.net/ajax/libs/es6-promise/4.1.1/es6-promise.min.js" type="text/javascript"></script>
1.3、通过下载到本地引入SweetAlert2

step1、通过包管理器安装SweetAlert2

包管理器安装命令
bowerbower install sweetalert2 --save
npmnpm install sweetalert2 --save
yarnyarn add sweetalert2

step2、在HTML代码中引入CSSJavaScript

<link  href="/bower_components/sweetalert2/dist/sweetalert2.min.css" rel="stylesheet">
<script src="/bower_components/sweetalert2/dist/sweetalert2.min.js" type="text/javascript"></script>
<!-- for IE support -->
<script src="/bower_components/es6-promise/promise.min.js" type="text/javascript"></script>
1.4、使用SweetAlert2