使用反应按钮关闭 sweetAlert 的问题

问题描述

我想用反应按钮关闭一个 sweetAlert,因为在关闭警报之前应该有其他操作。这是代码

swal({text:"Es befinden sich Artikel aus einem anderen Restaurant im Warenkorb",buttons:{cancel:"Continue with bag"},content:(
                                            <button onClick={()=>{
                                                console.log("here")
                                                swal.closeModal()
                                            }}>
                                                Delete shopping bag
                                            </button>
                                        )
                                    })

sweetalert 没有关闭,我认为按钮甚至没有被调用。文档说它是这样工作的。

这里是文档:https://sweetalert.js.org/guides/#using-with-libraries

你知道这是什么问题吗?提前致谢!

这是我的沙箱 https://codesandbox.io/s/cranky-morse-jmypy?file=/src/App.js

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)