Whi*_*ine 5 javascript sweetalert2
在9.0.0版本之前,我使用此代码完全禁用Toast警报上的动画。
Swal.fire({
animation : false,
toast: true,
....
});
Run Code Online (Sandbox Code Playgroud)
现在使用版本 9.* 我尝试使用此代码,结果看起来相同
Swal.fire({
showClass : { popup : "swal2-noanimation", backdrop : "swal2-noanimation", icon : "swal2-noanimation"},
//hideClass : { popup : "swal2-noanimation", backdrop : "swal2-noanimation", icon : "swal2-noanimation"},
toast: true,
....
});
Run Code Online (Sandbox Code Playgroud)
如果我还启用了属性hideClass,我将无法使用Swal.close()方法隐藏警报。
那么获得与之前相同的效果的正确解决方案是什么?
Lim*_*nte 12
根据折旧消息:
SweetAlert2:“动画”已弃用,将在下一个主要版本中删除。请改用“ showClass ”和“ hideClass ”。
Swal.fire({
icon: 'success',
title: 'I am not animated',
showClass: {
backdrop: 'swal2-noanimation', // disable backdrop animation
popup: '', // disable popup animation
icon: '' // disable icon animation
},
hideClass: {
popup: '', // disable popup fade-out animation
},
})Run Code Online (Sandbox Code Playgroud)
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>Run Code Online (Sandbox Code Playgroud)
阅读发行说明以查看所有重大更改:https : //github.com/sweetalert2/sweetalert2/releases/tag/v9.0.0
| 归档时间: |
|
| 查看次数: |
1847 次 |
| 最近记录: |