Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Inndy committed Apr 3, 2017
1 parent 210569e commit 6566e91
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,38 @@ A simple vuejs 2 binding for clipboard.js

## Install

`npm install --save vue-clipboard2` or use `dist/vue-clipboard.js` without webpack
`npm install --save vue-clipboard2` or use `dist/vue-clipboard.min.js` without webpack

## Usage

For vue-cli user:

```javascript
import Vue
import VueClipboard from 'vue-clipboard2'

Vue.use(VueClipboard)
```

For standalone usage:

```html
<script src="vue.min.js"></script>
<!-- must place this line after vue.js -->
<script src="dist/vue-clipboard.min.js"></script>
```

## Sample

```html
<div id="app"></div>

<template id="t">
<div class="container">
<input type="text" v-model="message">
<button type="button" v-clipboard:copy="message">Copy!</button>
<input type="text" v-model="message">
<button type="button"
v-clipboard:copy="message"
v-clipboard:success="onCopy">Copy!</button>
</div>
</template>

Expand All @@ -26,6 +47,11 @@ new Vue({
return {
message: 'Copy These Text'
}
},
methods: {
onCopy: function (e) {
alert("You just copied: " + e.text)
}
}
})
</script>
Expand Down

0 comments on commit 6566e91

Please sign in to comment.