mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-02 20:18:03 +08:00
chore: confirmBox 的 onConfirm 也可能是异步的 如果存在异步错误也需要捕获 (#5856)
* chore: confirmBox 的 onConfirm 也可能是异步的 如果存在异步错误也需要捕获 * 下发 loading
This commit is contained in:
parent
41319213ee
commit
70665092c1
@ -17,6 +17,7 @@ export interface ConfirmBoxProps extends LocaleProps, ThemeProps {
|
||||
children?:
|
||||
| JSX.Element
|
||||
| ((methods: {
|
||||
loading?: boolean;
|
||||
bodyRef: React.MutableRefObject<
|
||||
| {
|
||||
submit: () => Promise<Record<string, any>>;
|
||||
@ -77,7 +78,7 @@ export function ConfirmBox({
|
||||
return;
|
||||
}
|
||||
|
||||
onConfirm?.(ret);
|
||||
await onConfirm?.(ret);
|
||||
} catch (e) {
|
||||
setError(e.message);
|
||||
} finally {
|
||||
@ -103,7 +104,8 @@ export function ConfirmBox({
|
||||
<Modal.Body className={bodyClassName}>
|
||||
{typeof children === 'function'
|
||||
? children({
|
||||
bodyRef: bodyRef
|
||||
bodyRef: bodyRef,
|
||||
loading
|
||||
})
|
||||
: children}
|
||||
</Modal.Body>
|
||||
|
Loading…
Reference in New Issue
Block a user