Skip to content

Instantly share code, notes, and snippets.

@fadamakis
Created August 8, 2022 22:10
Show Gist options
  • Save fadamakis/66b4c2d55b8b687e2bffb2f23065b2e6 to your computer and use it in GitHub Desktop.
Save fadamakis/66b4c2d55b8b687e2bffb2f23065b2e6 to your computer and use it in GitHub Desktop.
import { useClipboard } from '@vueuse/core'
const source = ref('Hello')
const { text, copy, copied, isSupported } = useClipboard({ source })
<button @click='copy()'>
<!-- by default, `copied` will be reset in 1.5s -->
<span v-if='!copied'>Copy</span>
<span v-else>Copied!</span>
</button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment