File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1717 "date-fns" : " ^2.30.0" ,
1818 "pinia" : " ^2.0.30" ,
1919 "vue" : " ~2.7.14" ,
20- "vue-clipboard2" : " ^0.3.3" ,
2120 "vue-router" : " ~3.6.5" ,
2221 "vuelidate" : " ^0.7.7" ,
2322 "vuetify" : " ^2.6.13"
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ import Vue from 'vue'
22import App from '@/App.vue'
33import router from '@/router'
44import vuetify from '@/plugins/vuetify'
5- import VueClipboard from 'vue-clipboard2'
65import VueRouter from 'vue-router'
76import Vuelidate from 'vuelidate'
87import "@fontsource/roboto/300.css" /* light */
@@ -15,8 +14,6 @@ import {createPinia, PiniaVuePlugin} from "pinia";
1514
1615
1716Vue . config . productionTip = false
18- VueClipboard . config . autoSetContainer = true
19- Vue . use ( VueClipboard )
2017Vue . use ( Vuelidate )
2118// `Pinia` replaces `vuex` as store.
2219Vue . use ( PiniaVuePlugin )
Original file line number Diff line number Diff line change 3939 <pre class =" pa-3" >{{ ns.join('\n') }}</pre >
4040 <v-card-actions >
4141 <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'))"
4543 outlined
4644 text
4745 >
8886 <pre class =" pa-3" >{{ t.data }}</pre >
8987 <v-card-actions >
9088 <v-btn
91- v-clipboard:copy =" t.data"
92- v-clipboard:success =" copySuccess"
93- v-clipboard:error =" copyError"
89+ @click =" copyToClipboard(t.data)"
9490 outlined
9591 text
9692 >
@@ -193,11 +189,19 @@ export default {
193189 },
194190 },
195191 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+ }
201205 },
202206 showSnackbar : function (text ) {
203207 this .snackbar_text = text;
You can’t perform that action at this time.
0 commit comments