This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
|
import {error} from '@/message'
|
|
import {useI18n} from 'vue-i18n'
|
|
|
|
export function useCopyToClipboard() {
|
|
const {t} = useI18n({useScope: 'global'})
|
|
|
|
return async (text: string) => {
|
|
try {
|
|
await navigator.clipboard.writeText(text)
|
|
} catch {
|
|
error(t('misc.copyError'))
|
|
}
|
|
}
|
|
} |