diff --git a/proj/y2t/assets/js/main.js b/proj/y2t/assets/js/main.js index f5653f7..beb6774 100644 --- a/proj/y2t/assets/js/main.js +++ b/proj/y2t/assets/js/main.js @@ -1,16 +1,22 @@ Vue.component('copbox',{ template : `
+
Copy to clipboard
-
+
`, + data() { + return { + isSuccess: false + } + }, methods : { copyToClipboard() { const textToCopy = this.$refs.textToCopy; @@ -19,8 +25,15 @@ Vue.component('copbox',{ window.getSelection().removeAllRanges(); window.getSelection().addRange(range); document.execCommand('copy'); - window.getSelection().removeAllRanges(); + window.getSelection().removeAllRanges(); + this.successOk(); }, + successOk(){ + this.isSuccess = true; + this.$refs.element.addEventListener('animationend', () => { + this.isFaded = false; + }); + } } })