0

我正在使用来自“carbon-components-react”的 ModalWrapper

单击保存时,它不会关闭模式。如何强制关闭?

请参阅示例代码框 https://codesandbox.io/s/carbon-components-react-forked-n09un?file=/src/index.js

4

1 回答 1

0

使用ModalWrapper,您必须将shouldCloseAfterSubmit添加到您的 ModalWrapper 并在您的handleModalSave函数中返回 true

// HandleModalSave
const handleModalSave = (data, ssdf) => {
  return true;
};

// ModalWrapper
<ModalWrapper
  buttonTriggerText="Save"
  modalHeading="Save Table"
  handleSubmit={handleModalSave}
  primaryButtonText={primaryButtonText}
  shouldCloseAfterSubmit
>
于 2021-08-05T17:21:39.550 回答