Skip to content

Commit

Permalink
Merge pull request #11298 from lqPrototype/feat-signature
Browse files Browse the repository at this point in the history
feat: 签名组件增加回显
  • Loading branch information
allenve authored Dec 2, 2024
2 parents 40da906 + e109da7 commit 8cdf4ab
Show file tree
Hide file tree
Showing 4 changed files with 485 additions and 2 deletions.
1 change: 0 additions & 1 deletion packages/amis-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
"react-textarea-autosize": "8.3.3",
"react-transition-group": "4.4.2",
"react-visibility-sensor": "5.1.1",
"smooth-signature": "^1.0.15",
"sortablejs": "1.15.0",
"tinymce": "^6.1.2",
"tslib": "^2.3.1",
Expand Down
8 changes: 7 additions & 1 deletion packages/amis-ui/src/components/Signature.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React from 'react';
import {themeable, ThemeProps} from 'amis-core';
import {LocaleProps, localeable} from 'amis-core';
import {resizeSensor} from 'amis-core';
import SmoothSignature from 'smooth-signature';
import {SmoothSignature} from '../utils';
import Button from './Button';
import {Icon} from '../index';
import Modal from './Modal';
Expand Down Expand Up @@ -118,6 +118,12 @@ const Signature: React.FC<ISignatureProps> = props => {
[width, height, fullScreen]
);

React.useEffect(() => {
if (data && sign) {
sign.loadFromBase64(data);
}
}, [data, sign]);

function embedCanvasRef(ref: HTMLCanvasElement) {
if (open && ref && !sign) {
initCanvas(ref);
Expand Down
3 changes: 3 additions & 0 deletions packages/amis-ui/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import SmoothSignature from './smoothSignature';

export {SmoothSignature};
Loading

0 comments on commit 8cdf4ab

Please sign in to comment.