Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/euvl/v-clipboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Yev committed Dec 16, 2022
2 parents e6d0fef + 812c77c commit 2befad5
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@

## Vue Clipboard

### Demo

https://codesandbox.io/s/epic-waterfall-17yet5?file=/src/App.vue

### Install

```bash
Expand All @@ -22,7 +26,9 @@ Vue.use(Clipboard)

### Using

> When an element that contains `v-clipboard` directive is clicked, the value of `value` will be copied into clipboard.
When an element that contains `v-clipboard` directive is clicked, the value of `value` will be copied into clipboard.

---

Copying **static** value (directive should receive actual value):

Expand All @@ -32,6 +38,12 @@ Copying **static** value (directive should receive actual value):
</button>
```

```vue
<button v-clipboard="'some text'">
Copy to clipboard
</button>
```

Copying **dynamic** value (directive should recieve a function that returns value):

```vue
Expand All @@ -46,12 +58,19 @@ Copying **anything** in your methods:
this.$clipboard(value)
```

Without plugin:
```js
import { Clipboard } from "v-clipboard"

Clipboard.copy(value)
```

### Events

```vue
<button v-clipboard="foo"
v-clipboard:success="clipboardSuccessHandler" // Success event handler
v-clipboard:error="clipboardErrorHandler"> // Error event handler
v-clipboard:success="clipboardSuccessHandler"
v-clipboard:error="clipboardErrorHandler">
Copy to clipboard
</button>
```
Expand Down

0 comments on commit 2befad5

Please sign in to comment.