import { message } from 'antd' ; export function copyToClipboard ( text ) { var dummy = document . createElement ( 'input' ) ; document . body . appendChild ( dummy ) ; dummy . setAttribute ( 'value' , text ) ; dummy . select ( ) ; const result = document . execCommand ( 'copy' ) ; document . body . removeChild ( dummy ) ; if ( result ) { message . success ( '复制成功' ) ; } }