Sweet Alert在Swal.update中无法添加微调器。

问题描述 投票:0回答:1

我使用甜美的警报2和Angular 9("sweetalert2": "^9.7.2" on my package.json)。

我无法在Swal.update里面添加一个微调器(加载gif)。

在Swal.fire上就这样简单。

    Swal.fire({
      title: 'Iniciando...',
      allowOutsideClick: false,
      allowEscapeKey: false,
      allowEnterKey: false,

      onBeforeOpen: () => {
        Swal.showLoading();
      }
    });

在火灾发生后,我想更新警报的信息,因为我从后台更新了新的信息。

所以,我做了这样的事情。

 Swal.update({
          title: this.requestStatusPipe.transform(status),
          text: details
        });

标题和文字每秒钟都会刷新。

我试过添加很多东西 里面 更新后显示一个旋转器,但没有工作。例如

  onBeforeOpen: () => {
    Swal.showLoading();
  }

也用了

onRender: () => {
        Swal.showLoading();
      }

还有

        Swal.showLoading();

在Swal.更新后,什么都没有用。

我已经阅读了所有的 https:/sweetalert2.github.io。 却没有这方面的例子。

有什么想法吗?


OBS(和更新: 我已经检查了这些元素,现在我意识到这是由于一些风格问题。不知何故,spinner的样式从原来的

<button type="button" class="swal2-confirm swal2-styled" aria-label="" disabled="" style="display: inline-block; border-left-color: rgb(48, 133, 214); border-right-color: rgb(48, 133, 214);">OK</button>

<button type="button" class="swal2-confirm swal2-styled" aria-label="" disabled="" style="display: inline-block; border-left-color: rgba(0, 0, 0, 0); border-right-color: rgba(0, 0, 0, 0);">OK</button>

正如大家所看到的,边框颜色在没有任何解释的情况下从rgb(48, 133, 214)自动变为rgba(0, 0, 0, 0),使得微调器不可见。

有什么办法可以解决这个问题吗?

angular typescript sweetalert2
1个回答
0
投票

这是Sweet Alert的一个bug。它已经在9.10.13版本上得到了解决.这里是问题。https:/github.comsweetalert2sweetalert2issues1957。

© www.soinside.com 2019 - 2024. All rights reserved.