运行 多个甜蜜警报相继出现

Run multiple sweetalerts after eachother

我尝试 运行 多个甜蜜警报,但我现在拥有的代码只执行最后一个。有人知道为什么以及如何解决这个问题吗?

const { value: inhalt } = Swal.fire({
  title: 'Neue Ladegüter',
  text: 'Geben Sie einen Inhalt an:',
  input: 'text',
  showCancelButton: true,
  inputValidator: (value) => {
    if (!value) {
      return 'Field cannot be empty'
    }
  }
});

const { value: beschreibung } = Swal.fire({
  title: 'Neue Ladegüter',
  text: 'Geben Sie eine Beschreibung an:',
  input: 'text',
  showCancelButton: true,
  inputValidator: (value) => {
    if (!value) {
      return 'Field cannot be empty'
    }
  }
});

当您调用警报时,它会关闭最后一个,然后打开新的。它使用一个容器来显示警报。你应该在上次警报的响应上调用其他警报。

编辑:添加示例

Swal.fire({
  title: 'Neue Ladegüter',
  text: 'Geben Sie einen Inhalt an:',
  input: 'text',
  showCancelButton: true,
  inputValidator: (value) => {
    if (!value) {
      return 'Field cannot be empty'
    }
  }
}).then((res)=>{
    Swal.fire({
      title: 'Neue Ladegüter',
      text: 'Geben Sie eine Beschreibung an:',
      input: 'text',
      showCancelButton: true,
      inputValidator: (value) => {
        if (!value) {
          return 'Field cannot be empty'
        }
      }
    });
});