问题:使用sweetalert时报错:uncaught exception: SweetAlert: Unexpected 2nd argument (function(){})
解决:这是因为sweetalert2.0和1.0不同,function是1.0中的,2.0中可以使用then
方法:
swal({
title: '提示',
text: '2秒后将自动关闭',
timer: 2000,
buttons: false,
closeOnClickOutside: false,
})
.then(() => {
return $.post('/',{'sid': {{ sid }}});
})
.then(data => {
swal('成功');
})
.catch(err => {
swal('111');
});