前端: 添加确认对话框组件
This commit is contained in:
parent
16c37770c4
commit
918908664d
29
frontend/src/renderer/components/ConfirmDialog.jsx
Normal file
29
frontend/src/renderer/components/ConfirmDialog.jsx
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Modal } from 'antd';
|
||||||
|
|
||||||
|
function ConfirmDialog({
|
||||||
|
open,
|
||||||
|
title = '确认',
|
||||||
|
content = '确定要执行此操作吗?',
|
||||||
|
onConfirm,
|
||||||
|
onCancel,
|
||||||
|
confirmText = '确定',
|
||||||
|
cancelText = '取消',
|
||||||
|
danger = false
|
||||||
|
}) {
|
||||||
|
return (
|
||||||
|
<Modal
|
||||||
|
title={title}
|
||||||
|
open={open}
|
||||||
|
onOk={onConfirm}
|
||||||
|
onCancel={onCancel}
|
||||||
|
okText={confirmText}
|
||||||
|
cancelText={cancelText}
|
||||||
|
okButtonProps={{ danger }}
|
||||||
|
>
|
||||||
|
<p>{content}</p>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ConfirmDialog;
|
||||||
Loading…
Reference in New Issue
Block a user