import { message } from "antd"; import * as React from "react"; import { CopyToClipboard } from "react-copy-to-clipboard"; const styles = require("./styles.scss"); /** * * @param props {text:copy内容,msg提示内容,content:需要展示的内容,如果没有默认用text} */ export function Copy(props: { text: string; msg: string; content?: string }) { return ( message.success(`${props.msg}: 复制成功!`, 2)}> {props.content || props.text} ); } export function CopyFloat(props: { text: string; title: string; href?: string; content?: string }) { return ( message.success(`${props.title}: 复制成功!`, 2)} > {props.content && !props.href ? ( {props.content} ) : ( {props.href ? props.text : "复制"} )} ); }