UNPKG

828 BMarkdownView Raw
1# v-copy
2
3Vue directive to copy to clipboard.
4
5## Install
6
7```bash
8yarn add v-copy
9```
10
11CDN: [UNPKG](https://unpkg.com/v-copy/) | [jsDelivr](https://cdn.jsdelivr.net/npm/v-copy/) (It's automatically installed as global directive `v-copy` in CDN)
12
13## Usage
14
15First register the directive globally:
16
17```vue
18import Copy from 'v-copy'
19
20Vue.use(Copy)
21```
22
23Or locally:
24
25```js
26import { copy } from 'v-copy'
27
28export default {
29 directives: {
30 copy
31 }
32}
33```
34
35Then use it in template:
36
37```vue
38<template>
39 <button v-copy="`some text`">Copy!</button>
40</template>
41```
42
43## Browser support
44
45This supports what [copy-text-to-clipboard](https://github.com/sindresorhus/copy-text-to-clipboard) supports, namely ever-green browsers and IE9+. (Not all are carefully tested though :P)
46
47## License
48
49MIT &copy; [EGOIST](https://github.com/egoist)