File tree Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Expand file tree Collapse file tree 3 files changed +15
-15
lines changed Original file line number Diff line number Diff line change 17
17
"date-fns" : " ^2.30.0" ,
18
18
"pinia" : " ^2.0.30" ,
19
19
"vue" : " ~2.7.14" ,
20
- "vue-clipboard2" : " ^0.3.3" ,
21
20
"vue-router" : " ~3.6.5" ,
22
21
"vuelidate" : " ^0.7.7" ,
23
22
"vuetify" : " ^2.6.13"
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import Vue from 'vue'
2
2
import App from '@/App.vue'
3
3
import router from '@/router'
4
4
import vuetify from '@/plugins/vuetify'
5
- import VueClipboard from 'vue-clipboard2'
6
5
import VueRouter from 'vue-router'
7
6
import Vuelidate from 'vuelidate'
8
7
import "@fontsource/roboto/300.css" /* light */
@@ -15,8 +14,6 @@ import {createPinia, PiniaVuePlugin} from "pinia";
15
14
16
15
17
16
Vue . config . productionTip = false
18
- VueClipboard . config . autoSetContainer = true
19
- Vue . use ( VueClipboard )
20
17
Vue . use ( Vuelidate )
21
18
// `Pinia` replaces `vuex` as store.
22
19
Vue . use ( PiniaVuePlugin )
Original file line number Diff line number Diff line change 39
39
<pre class =" pa-3" >{{ ns.join('\n') }}</pre >
40
40
<v-card-actions >
41
41
<v-btn
42
- v-clipboard:copy =" ns.join('\n')"
43
- v-clipboard:success =" copySuccess"
44
- v-clipboard:error =" copyError"
42
+ @click =" copyToClipboard(ns.join('\n'))"
45
43
outlined
46
44
text
47
45
>
88
86
<pre class =" pa-3" >{{ t.data }}</pre >
89
87
<v-card-actions >
90
88
<v-btn
91
- v-clipboard:copy =" t.data"
92
- v-clipboard:success =" copySuccess"
93
- v-clipboard:error =" copyError"
89
+ @click =" copyToClipboard(t.data)"
94
90
outlined
95
91
text
96
92
>
@@ -193,11 +189,19 @@ export default {
193
189
},
194
190
},
195
191
methods: {
196
- copySuccess : function () {
197
- this .showSnackbar (" Copied to clipboard." );
198
- },
199
- copyError : function () {
200
- this .showSnackbar (" Copy to clipboard failed. Please try again manually." );
192
+ copyToClipboard : async function (text ) {
193
+ try {
194
+ await navigator .clipboard .writeText (text).then (
195
+ () => {
196
+ this .showSnackbar (" Copied to clipboard." );
197
+ },
198
+ () => {
199
+ this .showSnackbar (" Copy to clipboard not allowed. Please try again manually." );
200
+ },
201
+ );
202
+ } catch (e) {
203
+ this .showSnackbar (" Copy to clipboard failed. Please try again manually." );
204
+ }
201
205
},
202
206
showSnackbar : function (text ) {
203
207
this .snackbar_text = text;
You can’t perform that action at this time.
0 commit comments