【发布时间】:2022-09-26 18:18:03
【问题描述】:
我有一个对话框,我正在使用来自反应谱(旧版本)的 ModalTrigger。对话框有两个按钮,Okay 和 Cancel。取消时无事可做,但单击 Okay 时应触发操作,对话框应关闭并启动操作。我能够启动操作,但对话框没有关闭。
代码:
<ModalTrigger>
<Button label=\"Do something\" variant=\"action\"></Button>
<Dialog
confirmLabel=\"Confirm\"
cancelLabel=\"Cancel\"
mode=\"confirmation\"
onConfirm={props.confirmAction}
keyboardConfirm=\"true\"
backdropClickable={true}>
{title}
</Dialog>
</ModalTrigger>
当用户单击 onConfirm 然后启动 props.confirmAction 时,如何关闭对话框按钮?截至目前,对话框在 props.confirmAction 完成之前不会关闭。
标签: javascript reactjs dialog spectrumjs