Sweetalert 不适用于 IE 11,适用于 FireFox,Chrome
Sweetalert not working on IE 11, works on FireFox, Chrome
当我尝试从 IE 中执行 Sweetalert2 时,我遇到了一个非常奇怪的问题,但我没有显示任何内容。我已经在 SA 站点上阅读了添加 polyfill 的内容,但它并没有解决问题。
奇怪的是,如果我尝试 sweealert 演示站点,它会起作用。
当我尝试从 IE 的控制台调用 swal('ok') 时,我得到以下输出似乎是 class 内容而不是 exection
这是我的代码(我重新定义了警报)
<script type="text/javascript">
alert = function (msg, title, type) {
if (type == null)
type = 'error';
if (title == null)
title = 'Attenzione';
swal({
title: title,
text: msg,
type: type,
confirmButtonText: 'Ok'
});
}
function ShowToastr(message) {
swal({
position: 'top-end',
type: 'success',
title: message ? message : 'Operazione completata con successo',
showConfirmButton: false,
timer: 1500
});
}
</script>
在_Layout.cshtml里面我在头部
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@7.28.11/dist/sweetalert2.all.min.js"></script>
<!-- Include a polyfill for ES6 Promises (optional) for IE11, UC Browser and Android browser support -->
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.js"></script>
这是我尝试从控制台运行它时看到的
谢谢
您正在尝试更新 sweetAlert 配置。为此,您应该使用 mixin
像这样:
const toast = swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000
});
toast({
type: 'success',
title: 'Signed in successfully'
})
查看文档 link 请了解更多详情:sweetalert configuration
https://github.com/t4t5/sweetalert/issues/69
在 cdn 上你要求没有这个提交的旧版本
根据 https://github.com/sweetalert2/sweetalert2/releases/tag/v11.0.0 you should use v.10.16.7 旧浏览器支持
当我尝试从 IE 中执行 Sweetalert2 时,我遇到了一个非常奇怪的问题,但我没有显示任何内容。我已经在 SA 站点上阅读了添加 polyfill 的内容,但它并没有解决问题。
奇怪的是,如果我尝试 sweealert 演示站点,它会起作用。 当我尝试从 IE 的控制台调用 swal('ok') 时,我得到以下输出似乎是 class 内容而不是 exection
这是我的代码(我重新定义了警报)
<script type="text/javascript">
alert = function (msg, title, type) {
if (type == null)
type = 'error';
if (title == null)
title = 'Attenzione';
swal({
title: title,
text: msg,
type: type,
confirmButtonText: 'Ok'
});
}
function ShowToastr(message) {
swal({
position: 'top-end',
type: 'success',
title: message ? message : 'Operazione completata con successo',
showConfirmButton: false,
timer: 1500
});
}
</script>
在_Layout.cshtml里面我在头部
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@7.28.11/dist/sweetalert2.all.min.js"></script>
<!-- Include a polyfill for ES6 Promises (optional) for IE11, UC Browser and Android browser support -->
<script src="https://cdn.jsdelivr.net/npm/promise-polyfill@8/dist/polyfill.js"></script>
这是我尝试从控制台运行它时看到的
谢谢
您正在尝试更新 sweetAlert 配置。为此,您应该使用 mixin
像这样:
const toast = swal.mixin({
toast: true,
position: 'top-end',
showConfirmButton: false,
timer: 3000
});
toast({
type: 'success',
title: 'Signed in successfully'
})
查看文档 link 请了解更多详情:sweetalert configuration
https://github.com/t4t5/sweetalert/issues/69
在 cdn 上你要求没有这个提交的旧版本
根据 https://github.com/sweetalert2/sweetalert2/releases/tag/v11.0.0 you should use v.10.16.7 旧浏览器支持