Home > @dinofe/xt-core > copyToClipboard
# copyToClipboard() function
复制文本到剪贴板
Signature:
export declare function copyToClipboard(text: string): Promise<void>;
# Parameters
Parameter | Type | Description |
---|---|---|
text | string | 要复制的字符串 |
Returns:
Promise<void>
返回一个Promise对象,成功会resolve,失败会reject
# Example
import { copyToClipboard } from '@dinofe/xt-core/web'
copyToClipboard('hello').then(() => {
console.log('支付成功')
}).catch(e => {
console.log(e.message)
})