|
@@ -0,0 +1,32 @@
|
|
1
|
+import React from 'react';
|
|
2
|
+import { Modal, Button } from 'antd';
|
|
3
|
+
|
|
4
|
+export default function ModalButton(props) {
|
|
5
|
+ const {
|
|
6
|
+ method = 'confirm',
|
|
7
|
+ title = '',
|
|
8
|
+ content = '',
|
|
9
|
+ modalConfigs = {},
|
|
10
|
+ onClick,
|
|
11
|
+ onCancel,
|
|
12
|
+ ...btnProps
|
|
13
|
+ } = props || {}
|
|
14
|
+
|
|
15
|
+ const handleClick = e => {
|
|
16
|
+ Modal[method]({
|
|
17
|
+ title,
|
|
18
|
+ content,
|
|
19
|
+ ...modalConfigs,
|
|
20
|
+ onOk() {
|
|
21
|
+ // eslint-disable-next-line no-unused-expressions
|
|
22
|
+ onClick && onClick(e);
|
|
23
|
+ },
|
|
24
|
+ onCancel() {
|
|
25
|
+ // eslint-disable-next-line no-unused-expressions
|
|
26
|
+ onCancel && onCancel();
|
|
27
|
+ },
|
|
28
|
+ })
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+ return <Button {...btnProps} onClick={handleClick}>{props.children}</Button>
|
|
32
|
+}
|