From 38fa3368163f198a4fee2169907da8f7c639b449 Mon Sep 17 00:00:00 2001 From: gexinzhineng/gxzn27 <1348660141@qq.com> Date: Wed, 31 May 2023 17:28:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../infra/codegen/components/Preview.vue | 18 +++++++-------- src/views/infra/fileList/index.vue | 23 ++++++++----------- 2 files changed, 19 insertions(+), 22 deletions(-) diff --git a/src/views/infra/codegen/components/Preview.vue b/src/views/infra/codegen/components/Preview.vue index 30f4c04d..f9769b17 100644 --- a/src/views/infra/codegen/components/Preview.vue +++ b/src/views/infra/codegen/components/Preview.vue @@ -129,15 +129,6 @@ const handleFiles = (datas: CodegenPreviewVO[]) => { } /** 复制 **/ const copy = async (text: string) => { - let url = text - let oInput = document.createElement('textarea') - oInput.value = url - document.body.appendChild(oInput) - oInput.select() // 选择对象; - // console.log(oInput.value) - document.execCommand('Copy') // 执行浏览器复制命令 - message.success('复制成功') - oInput.remove() // const { copy, copied, isSupported } = useClipboard({ source: text }) // if (!isSupported.value) { // message.error(t('common.copyError')) @@ -147,6 +138,15 @@ const copy = async (text: string) => { // message.success(t('common.copySuccess')) // } // } + let url = text + let oInput = document.createElement('textarea') + oInput.value = url + document.body.appendChild(oInput) + oInput.select() // 选择对象; + // console.log(oInput.value) + document.execCommand('Copy') // 执行浏览器复制命令 + message.success(t('common.copySuccess')) + oInput.remove() } defineExpose({ show diff --git a/src/views/infra/fileList/index.vue b/src/views/infra/fileList/index.vue index 1d79cb9e..743dbad5 100644 --- a/src/views/infra/fileList/index.vue +++ b/src/views/infra/fileList/index.vue @@ -54,8 +54,8 @@ :on-exceed="handleExceed" :on-success="handleFileSuccess" :on-error="excelUploadError" - :on-change="handleFileChange" :before-remove="beforeRemove" + :on-change="handleFileChange" :auto-upload="false" accept=".jpg, .png, .gif" > @@ -168,6 +168,15 @@ const uploadDialog = () => { } // ========== 复制相关 ========== const handleCopy = async (text: string) => { + // const { copy, copied, isSupported } = useClipboard({ source: text, read: true }) + // if (!isSupported.value) { + // message.error(t('common.copyError')) + // } else { + // await copy() + // if (unref(copied.value)) { + // message.success(t('common.copySuccess')) + // } + // } let url = text let oInput = document.createElement('textarea') oInput.value = url @@ -177,17 +186,5 @@ const handleCopy = async (text: string) => { document.execCommand('Copy') // 执行浏览器复制命令 message.success(t('common.copySuccess')) oInput.remove() - // const { copy, copied, isSupported } = useClipboard({ source: text, read: true }) - // console.log(copy, 'copycopycopy') - // console.log(copied, 'copiedcopiedcopied') - // console.log(isSupported, 'isSupportedisSupportedisSupported') - // if (!isSupported.value) { - // message.error(t('common.copyError')) - // } else { - // await copy() - // if (unref(copied.value)) { - // message.success(t('common.copySuccess')) - // } - // } }