zy-react-library 1.0.99 → 1.0.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Button, Image, message, Modal } from "antd";
|
|
2
2
|
import dayjs from "dayjs";
|
|
3
|
-
import { useRef, useState } from "react";
|
|
3
|
+
import { useEffect, useRef, useState } from "react";
|
|
4
4
|
import SignatureCanvas from "react-signature-canvas";
|
|
5
5
|
import { base642File } from "../../utils";
|
|
6
6
|
|
|
@@ -12,12 +12,16 @@ function Signature(props) {
|
|
|
12
12
|
onConfirm,
|
|
13
13
|
width = 752,
|
|
14
14
|
height = 300,
|
|
15
|
+
url = "",
|
|
15
16
|
...restProps
|
|
16
17
|
} = props;
|
|
17
18
|
|
|
18
19
|
const [signatureModalOpen, setSignatureModalOpen] = useState(false);
|
|
19
20
|
const signatureCanvas = useRef(null);
|
|
20
21
|
const [base64, setBase64] = useState("");
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setBase64(url);
|
|
24
|
+
}, [url]);
|
|
21
25
|
|
|
22
26
|
const onOk = () => {
|
|
23
27
|
if (signatureCanvas.current.isEmpty()) {
|
|
@@ -49,7 +53,7 @@ function Signature(props) {
|
|
|
49
53
|
</div>
|
|
50
54
|
{base64 && (
|
|
51
55
|
<div style={{ border: "1px dashed #d9d9d9", width, height, marginTop: 16 }}>
|
|
52
|
-
<Image src={base64} />
|
|
56
|
+
<Image src={base64} style={{ width, height, objectFit: "contain" }} />
|
|
53
57
|
</div>
|
|
54
58
|
)}
|
|
55
59
|
<Modal
|