Skip to content

Commit ac3429c

Browse files
committed
fix: #540 optimize Copy
1 parent 5a3a465 commit ac3429c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/copy/index.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
/**
2+
* Changelog:
3+
* 1. 修改 use-clippy 为 @dtinsight/dt-utils 中的 CopyUtils,原因详见 https://github.com/DTStack/dt-react-component/issues/540
4+
*/
15
import React, { CSSProperties, ReactNode } from 'react';
6+
import { CopyUtils } from '@dtinsight/dt-utils';
27
import { message, Tooltip } from 'antd';
38
import classNames from 'classnames';
4-
import useClippy from 'use-clippy';
59

610
import { LabelTooltipType, toTooltipProps } from '../utils';
711
import './style.scss';
@@ -40,11 +44,9 @@ const Copy: React.FC<ICopyProps> = (props) => {
4044
className,
4145
onCopy = () => message.success('复制成功'),
4246
} = props;
43-
const [_, setClipboard] = useClippy();
4447

4548
const handleCopy = () => {
46-
setClipboard(text);
47-
onCopy(text);
49+
new CopyUtils().copy(text, () => onCopy(text));
4850
};
4951

5052
const renderCopyButton = () => (

0 commit comments

Comments
 (0)