【发布时间】:2019-04-11 11:19:51
【问题描述】:
我正在使用 SweetAlert2 来提醒用户。当我点击确认按钮时,行为符合预期,删除关键字调用。
render: function() {
return(
<SweetAlert show={this.state.show} title="Context Processor"
text="Keyword deletion cannot be undone. Do you still want to continue?"
onConfirm={this.deleteKeyword}
showCloseButton={true}
heightAuto={false}>
</SweetAlert>
)},
deleteKeyword: function() {
this.setState({show: false});
this.props.deleteKeyword(this.state.keyword);
},
但是,当我简单地关闭警报框时,就会再次调用!我浏览了图书馆提供的各种选项 - https://github.com/kessejones/react-sweetalert2/blob/master/src/ReactSweetAlert2.js 但我找不到任何感兴趣的东西。
此外,添加了showCloseButton 参数,但是当我再次单击它时,会进行删除关键字调用。
有什么建议吗?
【问题讨论】:
标签: reactjs sweetalert2 cancel-button