以编程方式关闭模态(react实体化)



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

它看起来像这样:

<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>

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

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

参考编号:https://react-materialize.github.io/react-materialize/?path=/story/javascript-modal—默认

最新更新