一、下载安装
地址:https://github.com/limonte/sweetalert2
二、页面引用
当然还有jquery
三、示例
3.1、基础结构
window.οnlοad=function(){
swal("Here‘s a message!");//以下代码主要修改这里
}
3.2、精简用法
1、标题【alert】-swal(string)
swal("Here‘s a message!")
2、标题和描述【alert】-swal(string,string)
swal("Title","des")
3.标题、描述、成功【alert】-swal(string,string,string)
swal("Good job!", "You clicked the button!", "success")
3.3、标准使用
swal({
title:‘Auto close alert!‘,
text:‘I will close in 2 seconds.‘,
type: ‘success‘}).then(function([isConfirm]) {},//handling the promise rejection
function(dismiss) {//dismiss can be ‘cancel‘, ‘overlay‘,
//‘close‘, and ‘timer‘
}
)
4、输入框