Sweetalert2 allowedOutsideClick 在 Toast 模式下不起作用,并且关闭按钮未出现在右侧

deg*_*147 3 javascript sweetalert sweetalert2

我正在使用https://sweetalert2.github.io/的 Sweetalert2 ,这是我的配置

  swal({
      title: 'Success!',
      type: 'success',
      toast: true,
      html: response.message,
      showCloseButton: true,
      showCancelButton: true,
      allowEscapeKey: true,
      allowOutsideClick: true,
      //focusConfirm: false,
      confirmButtonText: 'Continue Shopping',
      confirmButtonAriaLabel: 'Continue Shopping',
      cancelButtonText: '<a href="' + cartLink + '" style="color:white;">View Cart and Checkout</a>',
      cancelButtonColor: '#ff6d02',
      cancelButtonAriaLabel: 'Cart',
  });
Run Code Online (Sandbox Code Playgroud)

这是结果

斯瓦尔

所以,问题是 externalclick true 配置不起作用,并且关闭按钮不在右侧。请问我该如何解决这个问题?

Lim*_*nte 6

我是 SweetAlert2 的作者,感谢您提出这个问题。

1. 关闭按钮

关闭按钮不在右侧

此问题已在最新版本 ( v7.26.4) 中修复,请更新您的依赖项。

2、allowOutsideClick参数

allowOutsideClick参数与 toast 不兼容,因为 toast 是无模式的并且没有背景。在最新版本中,您将收到有关与 toast 参数不兼容的控制台警告:

图像