index.tsx
906 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import type { ReactNode } from 'react';
import { UModal } from '@uj/ui';
export interface ConfirmModalProps {
open: boolean;
content: ReactNode;
title?: ReactNode;
width?: number;
okText?: string;
cancelText?: string;
confirmLoading?: boolean;
onCancel: () => void;
onConfirm: () => void;
}
/** 通用二次确认弹窗,业务页面负责传入提示内容和确认动作。 */
export function ConfirmModal({
open,
content,
title = '提示',
width = 420,
okText = '确定',
cancelText = '取消',
confirmLoading,
onCancel,
onConfirm,
}: ConfirmModalProps) {
return (
<UModal
open={open}
title={title}
width={width}
okText={okText}
cancelText={cancelText}
confirmLoading={confirmLoading}
onCancel={onCancel}
onOk={onConfirm}
>
<div style={{ padding: '8px 0 24px' }}>{content}</div>
</UModal>
);
}