reactjs - 如何在保存时关闭碳模态
问题描述
我正在使用来自“carbon-components-react”的 ModalWrapper
单击保存时,它不会关闭模式。如何强制关闭?
请参阅示例代码框 https://codesandbox.io/s/carbon-components-react-forked-n09un?file=/src/index.js
解决方案
使用ModalWrapper,您必须将shouldCloseAfterSubmit添加到您的 ModalWrapper 并在您的handleModalSave函数中返回 true
// HandleModalSave
const handleModalSave = (data, ssdf) => {
return true;
};
// ModalWrapper
<ModalWrapper
buttonTriggerText="Save"
modalHeading="Save Table"
handleSubmit={handleModalSave}
primaryButtonText={primaryButtonText}
shouldCloseAfterSubmit
>
推荐阅读
- xpath - 鉴于兄弟节点条件为真,有没有办法计算节点数?
- java - 暂停视频时,ExoPlayer 不会保持音频焦点
- mysql - 左外连接,从左边查找所有在右表中没有出现的,mysql
- javascript - 无限随机数动画作为div
- ios - 将多个操作绑定到单个控件事件时,绑定顺序是否重要?
- tfs - TFS 回滚重命名文件,无需手动干预即可重命名 (TFVC)
- r - 使用边界值优化 r 中的函数
- c# - 数据源未显示正确值的图表
- corda - 有什么方法可以从流中判断节点是否处于 devMode 中?
- sql-server - SSMS 18.1 Azure AD 连接选项弹出窗口