add copy to clipboard
This commit is contained in:
1 parent
e3e0c0525a
commit
f6065f4672
4 files changed
+58
-2
No files matched your search
@@ -33,6 +33,7 @@
|
||||
"@types/uuid": "^8.3.4",
|
||||
"axios": "^0.21.1",
|
||||
"codemirror": "^6.0.1",
|
||||
"copy-to-clipboard": "^3.3.3",
|
||||
"dayjs": "^1.10.7",
|
||||
"element-plus": "^1.3.0-beta.10",
|
||||
"github-markdown-css": "^5.1.0",
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<template>
|
||||
<font-awesome-icon v-if="!copied" icon="fa-regular fa-copy" @click="onCopy" />
|
||||
<el-tooltip v-else :visible="copied" effect="dark" :content="$t('common.message.copied')" placement="top-start">
|
||||
<font-awesome-icon icon="fa-solid fa-check" />
|
||||
</el-tooltip>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import copy from 'copy-to-clipboard';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'CopyToClipboard',
|
||||
components: {
|
||||
FontAwesomeIcon
|
||||
},
|
||||
props: {
|
||||
content: {
|
||||
type: String,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
copied: false
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
onCopy() {
|
||||
copy(this.content, {
|
||||
debug: true
|
||||
});
|
||||
this.copied = true;
|
||||
setTimeout(() => {
|
||||
this.copied = false;
|
||||
}, 3000);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@@ -32,7 +32,7 @@
|
||||
<template #default="scope">
|
||||
<span class="key">{{ scope.row.api_key }}</span>
|
||||
<span class="copy">
|
||||
<font-awesome-icon icon="fa-regular fa-copy" />
|
||||
<copy-to-clipboard :content="scope.row.api_key" />
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@@ -67,6 +67,7 @@ import { defineComponent } from 'vue';
|
||||
import { applicationOperator, IApplication, IApplicationListResponse, IService } from '@/operators';
|
||||
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome';
|
||||
import Pagination from '@/components/common/Pagination.vue';
|
||||
import CopyToClipboard from '@/components/common/CopyToClipboard.vue';
|
||||
|
||||
interface IData {
|
||||
applications: IApplication[];
|
||||
@@ -80,7 +81,8 @@ export default defineComponent({
|
||||
name: 'ApplicationList',
|
||||
components: {
|
||||
FontAwesomeIcon,
|
||||
Pagination
|
||||
Pagination,
|
||||
CopyToClipboard
|
||||
},
|
||||
data(): IData {
|
||||
return {
|
||||
|
||||
@@ -1160,6 +1160,13 @@ constantinople@^4.0.1:
|
||||
"@babel/parser" "^7.6.0"
|
||||
"@babel/types" "^7.6.1"
|
||||
|
||||
copy-to-clipboard@^3.3.3:
|
||||
version "3.3.3"
|
||||
resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.3.tgz#55ac43a1db8ae639a4bd99511c148cdd1b83a1b0"
|
||||
integrity sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==
|
||||
dependencies:
|
||||
toggle-selection "^1.0.6"
|
||||
|
||||
cosmiconfig@^7.0.1:
|
||||
version "7.0.1"
|
||||
resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.1.tgz#714d756522cace867867ccb4474c5d01bbae5d6d"
|
||||
@@ -3268,6 +3275,11 @@ to-regex-range@^5.0.1:
|
||||
dependencies:
|
||||
is-number "^7.0.0"
|
||||
|
||||
toggle-selection@^1.0.6:
|
||||
version "1.0.6"
|
||||
resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32"
|
||||
integrity sha512-BiZS+C1OS8g/q2RRbJmy59xpyghNBqrr6k5L/uKBGRsTfxmu3ffiRnd8mlGPUVayg8pvfi5urfnu8TU7DVOkLQ==
|
||||
|
||||
token-stream@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/token-stream/-/token-stream-1.0.0.tgz#cc200eab2613f4166d27ff9afc7ca56d49df6eb4"
|
||||
|
||||
Reference in new issue
Block a user