以编程方式关闭模态(反应实现)

问题描述 投票:0回答:1

我不知道如何以编程方式关闭模式(例如,用户登录后的登录模式)。

看起来像这样:

<Modal
  actions={[
    <Button flat modal="close" node="button" waves="green">
      Close
    </Button>
  ]}
  bottomSheet={false}
  fixedFooter={false}
  header="Log in"
  id="modal-login"
  options={{
    dismissible: true,
    endingTop: "10%",
    inDuration: 250,
    onCloseEnd: null,
    onCloseStart: null,
    onOpenEnd: null,
    onOpenStart: null,
    opacity: 0.5,
    outDuration: 250,
    preventScrolling: true,
    startingTop: "4%"
  }}
>
  <form onSubmit={e => /* log in user */}>
    <input type="email"/>
    <input type="password"/>
    <button>Log in</button>
  </form>
</Modal>
reactjs modal-dialog materialize
1个回答
0
投票

使用打开道具以编程方式打开或关闭模态

<Modal
  open={isModalOpen}
  ...
/>

参考:https://react-materialize.github.io/react-materialize/?path=/story/javascript-modal--default

© www.soinside.com 2019 - 2024. All rights reserved.