Swal.fire({ title: '标题', text: 'SweetAlert2 对话框内容', type: 'success' }).then(function(){ window.location.replace("/"); });
SweetAlert2 按钮事件响应完整示例:
Swal.fire({ title: 'Do you want to save the changes?', showDenyButton: true, showCancelButton: true, confirmButtonText: `Save`, denyButtonText: `Don't save`, }).then((result) => { /* Read more about isConfirmed, isDenied below */ if (result.isConfirmed) { Swal.fire('Saved!', '', 'success') } else if (result.isDenied) { Swal.fire('Changes are not saved', '', 'info') } })