Skip to content

Commit

Permalink
Release: 0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
Inndy committed Apr 20, 2017
1 parent 8f2c7d1 commit 55cc164
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ For standalone usage:
<input type="text" v-model="message">
<button type="button"
v-clipboard:copy="message"
v-clipboard:success="onCopy">Copy!</button>
v-clipboard:success="onCopy"
v-clipboard:error="onError">Copy!</button>
</div>
</template>

Expand All @@ -50,7 +51,10 @@ new Vue({
},
methods: {
onCopy: function (e) {
alert("You just copied: " + e.text)
alert('You just copied: ' + e.text)
},
onError: function (e) {
alert('Failed to copy texts')
}
}
})
Expand Down
10 changes: 10 additions & 0 deletions dist/vue-clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -761,6 +761,8 @@ var VueClipboard = {
bind: function (el, binding, vnode) {
if(binding.arg === 'success') {
el._v_clipboard_success = binding.value
} else if(binding.arg === 'error') {
el._v_clipboard_error = binding.value
} else {
var clipboard = new Clipboard(el, {
text: function () { return binding.value },
Expand All @@ -770,12 +772,18 @@ var VueClipboard = {
var callback = el._v_clipboard_success
callback && callback(e)
})
clipboard.on('error', function (e) {
var callback = el._v_clipboard_error
callback && callback(e)
})
el._v_clipboard = clipboard
}
},
update: function (el, binding) {
if(binding.arg === 'success') {
el._v_clipboard_success = binding.value
} else if(binding.arg === 'error') {
el._v_clipboard_error = binding.value
} else {
el._v_clipboard.text = function () { return binding.value }
el._v_clipboard.action = function () { return binding.arg === 'cut' ? 'cut' : 'copy' }
Expand All @@ -784,6 +792,8 @@ var VueClipboard = {
unbind: function (el, binding) {
if(binding.arg === 'success') {
delete el._v_clipboard_success
} else if(binding.arg === 'error') {
delete el._v_clipboard_error
} else {
el._v_clipboard.destroy()
delete el._v_clipboard
Expand Down
2 changes: 1 addition & 1 deletion dist/vue-clipboard.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vue-clipboard2",
"version": "0.0.5",
"version": "0.0.6",
"description": "A Vuejs2 binding for clipboard.js",
"main": "vue-clipboard.js",
"scripts": {
Expand Down

0 comments on commit 55cc164

Please sign in to comment.