javascript - Sweetalert2 allowOutsideClick 在 toast 模式下不起作用,关闭按钮未出现在右侧

标签 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',
  });

这是结果

swal

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

最佳答案

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

1。关闭按钮

close button is not on the right

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

2。 allowOutsideClick 参数

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

image

关于javascript - Sweetalert2 allowOutsideClick 在 toast 模式下不起作用,关闭按钮未出现在右侧,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51535155/

相关文章:

javascript - 突出显示由异步请求数据动态填充的表中的一行

validation - SweetAlert2 : Validation required for one of the fields

javascript - Sweet Alert window.prompt 传值给服务器

javascript - 突出显示 sweetAlert 中的默认文本输入

javascript - 使用 2 个按钮 + sweetalert2 提交表单

javascript - 这段代码中 (t/=d/2) 是什么意思?

javascript - 使用 node.js 执行一个 exe 文件

javascript - 如何将jpeg字符串转换为base64

jquery - 甜蜜警报 2 多个复选框

javascript - 如何更改 SweetAlert2 的关闭动画?