Skip to content

Commit 59e6d7d

Browse files
committed
docs: README.md
1 parent 7343f61 commit 59e6d7d

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

README.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,69 @@ vue-copy-to-cliboard
22
----
33

44
Copy to clipboard Vue component
5+
6+
### Use
7+
8+
```bash
9+
$ npm install vue-copy-to-clipboard
10+
or
11+
$ yarn add vue-copy-to-clipboard
12+
```
13+
14+
15+
### Examples
16+
17+
```jsx
18+
// by jsx
19+
import CopyToClipboard from 'vue-copy-to-clipboard'
20+
21+
export default {
22+
data () {
23+
return {
24+
text: 'is copy content'
25+
}
26+
},
27+
render (h) {
28+
return (
29+
<div>
30+
<CopyToClipboard text={this.text} onCopy={(result) => {
31+
console.log('onCopy', result)
32+
}}>
33+
<Button>Copy to Clipboard</Button>
34+
</CopyToClipboard>
35+
</div>
36+
)
37+
}
38+
}
39+
```
40+
41+
```vue
42+
<template>
43+
<div>
44+
<copy-to-clipboard :text="text" @copy="handleCopy">
45+
<a-button>Copy to Clipboard</a-button>
46+
</copy-to-clipboard>
47+
</div>
48+
</template>
49+
50+
<script>
51+
// by template.vue
52+
import CopyToClipboard from 'vue-copy-to-clipboard'
53+
54+
export default {
55+
components: {
56+
CopyToClipboard
57+
},
58+
data () {
59+
return {
60+
text: '这里可以动态生成内容'
61+
}
62+
},
63+
methods: {
64+
handleCopy (result) {
65+
console.log('onCopy', result)
66+
}
67+
}
68+
}
69+
</script>
70+
```

0 commit comments

Comments
 (0)