是什么 ? | : | 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 |
SweetAlert2
是SweetAlert
的升级版本,在SweetAlert的基础上增加了一些功能,更加强大了。
<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>
<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>
step1、通过包管理器
安装SweetAlert2
包管理器 | 安装命令 |
---|---|
bower | bower install sweetalert2 --save |
npm | npm install sweetalert2 --save |
yarn | yarn add sweetalert2 |
step2、在HTML代码中引入CSS和JavaScript
<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>