Sweetalert: 未捕获的异常:取消

创建于 2016-12-01  ·  5评论  ·  资料来源: t4t5/sweetalert

当我单击 Sweetalert2 中的“取消”按钮时会显示此错误

swal({ title: menu_title, text: title, input: "text", showCancelButton: true, animation: "slide-from-top", showLoaderOnConfirm: true, inputPlaceholder: lang.write_your_comment, preConfirm: function(inputValue) { return new Promise(function(resolve, reject) { resolve('ok'); }); }) }, allowOutsideClick: false }).then(function(result){ var res = $.parseJSON(result); if(res.status){ swal({ title: lang.thankyou+"!", text: lang.your_feedback_sent, type: "success" }).then(function(confirm){ location.reload(); }); } else{ swal({ title: lang.sorry+"!", text: res.message, type: "warning" }); } });

最有用的评论

如果有人来到这里并被卡住(因为sweetalert != sweetalert2 !)

swal({...})的末尾,添加: .catch(() => swal.close())

每个承诺函数都需要一个失败回调。

所有5条评论

当点击关闭图标时,它也显示错误,
未捕获的异常:关闭

应该张贴在这里: https :

如果有人来到这里并被卡住(因为sweetalert != sweetalert2 !)

swal({...})的末尾,添加: .catch(() => swal.close())

每个承诺函数都需要一个失败回调。

@eminx你救了我的一天 :)

@eminx我也是!!

此页面是否有帮助?
0 / 5 - 0 等级