Sweetalert2:使用版本 >= 9.0.0 完全禁用动画的正确方法

Sweetalert2 : correct way to completely disable animation with version >= 9.0.0

在版本 9.0.0 之前,我使用此代码完全禁用 toast 警报上的动画。

Swal.fire({
    animation : false,
    toast: true,
    ....
});

现在版本 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,
    ....
});

如果我还启用 属性 hideClass 我无法使用 Swal.close()[= 方法隐藏警报24=].

那么正确的解决方案是什么才能获得与以前相同的效果?

根据弃用消息:

SweetAlert2: "animation" is deprecated and will be removed in the next major release. Please use "showClass" and "hideClass" instead.

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
  },
})
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>

阅读发行说明以查看所有重大更改:https://github.com/sweetalert2/sweetalert2/releases/tag/v9.0.0