gpt4 book ai didi

javascript - 甜蜜警报2 : correct way to completely disable animation with version >= 9. 0.0

转载 作者:行者123 更新时间:2023-12-02 00:10:31 26 4
gpt4 key购买 nike

在版本 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()隐藏警报。

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

最佳答案

根据拒绝消息:

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

关于javascript - 甜蜜警报2 : correct way to completely disable animation with version >= 9. 0.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58764296/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com