mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 17:19:11 +08:00
8cc1d30351
* feat: copy support async * feat: add test * feat: doc * feat: snap * feat: add loading * feat: 恢复 try * feat: 判断是否是 Error * feat: throw error * feat: 为了醋包了饺子 * feat: remove code * feat: add loading test * fix: test * fix: icon import way * chore: improve test case code * chore: improve test case code --------- Co-authored-by: afc163 <afc163@gmail.com>
37 lines
992 B
TypeScript
37 lines
992 B
TypeScript
import React from 'react';
|
|
import { SmileFilled, SmileOutlined } from '@ant-design/icons';
|
|
import { Typography } from 'antd';
|
|
|
|
const { Paragraph, Text } = Typography;
|
|
|
|
const App: React.FC = () => (
|
|
<>
|
|
<Paragraph copyable>This is a copyable text.</Paragraph>
|
|
<Paragraph copyable={{ text: 'Hello, Ant Design!' }}>Replace copy text.</Paragraph>
|
|
<Paragraph
|
|
copyable={{
|
|
icon: [<SmileOutlined key="copy-icon" />, <SmileFilled key="copied-icon" />],
|
|
tooltips: ['click here', 'you clicked!!'],
|
|
}}
|
|
>
|
|
Custom Copy icon and replace tooltips text.
|
|
</Paragraph>
|
|
<Paragraph copyable={{ tooltips: false }}>Hide Copy tooltips.</Paragraph>
|
|
<Text copyable />
|
|
<Paragraph
|
|
copyable={{
|
|
text: async () =>
|
|
new Promise((resolve) => {
|
|
setTimeout(() => {
|
|
resolve('Request text');
|
|
}, 500);
|
|
}),
|
|
}}
|
|
>
|
|
Request copy text.
|
|
</Paragraph>
|
|
</>
|
|
);
|
|
|
|
export default App;
|