Ped*_*nio 6 javascript jquery internet-explorer-11 sweetalert2
我正在使用SweetAlert2示例页面的确切代码:
swal({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.value) {
swal(
'Deleted!',
'Your file has been deleted.',
'success'
)
}
})
Run Code Online (Sandbox Code Playgroud)
适用于Firefox和Chrome,但是Internet Explorer显示SCRIPT1002: Syntax Error并且不运行脚本... IE将此部分标记为语法错误:
}).then((result) => {
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助
Ror*_*san 15
(result) => {}是一个在IE中完全不支持的箭头功能.要解决这个问题,你必须使用传统的匿名函数:
swal({
// options...
}).then(function(result) {
if (result.value) {
swal('Deleted!', 'Your file has been deleted.', 'success');
}
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3926 次 |
| 最近记录: |