From ef6f9c7371d042c3cd1290b61592b5a602e9ac75 Mon Sep 17 00:00:00 2001 From: zhangyahui Date: Tue, 3 Mar 2026 14:40:49 +0800 Subject: [PATCH] =?UTF-8?q?bugfix:=20=E5=A4=8D=E5=88=B6=E5=AF=B9=E8=AF=9D?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/assets/images/close-icon.png | Bin 212 -> 271 bytes src/lang/en.ts | 2 +- src/views/home/agent/components/Agent.vue | 3 +- src/views/home/agent/components/Item.vue | 54 ++++++++++++++++------ src/views/home/components/Input.vue | 41 ++++++++-------- 5 files changed, 61 insertions(+), 39 deletions(-) diff --git a/src/assets/images/close-icon.png b/src/assets/images/close-icon.png index 5708e37f925a2f92de06cfd6a888c491706f0149..a950eb22a5e2a5254b1f4b0adae011f6be640139 100644 GIT binary patch delta 193 zcmV;y06zcJ0gnQZR(}q3MObuGZ)S9NVRB^vMrmhlVV<#;V*mgEib+I4RCobxkU4S+BREZw60*im$H-9-G9F%V*#pknMLO`3z_ z4xrY$hYNGg`3MF?RG4|ye{5Wlw~1(SnzR<+L7+|s!HaX$Xk4&If-fuEWHbI^+ { - navigator.clipboard - .writeText(props.content.text) - .then(() => { - // console.log('Text copied to clipboard'); - ElMessage({ - message: t('agent.copySuccess'), - type: 'success', - offset: 300 + const text = props.content.text + if (navigator.clipboard) { + navigator.clipboard + .writeText(props.content.text) + .then(() => { + // console.log('Text copied to clipboard'); + ElMessage({ + message: t('agent.copySuccess'), + type: 'success', + offset: 300 + }) }) - }) - .catch((err) => { - console.error('Could not copy text: ', err) - ElMessage({ - message: t('agent.copyFailed'), - type: 'error', - offset: 300 + .catch((err) => { + console.error('Could not copy text: ', err) + ElMessage({ + message: t('agent.copyFailed'), + type: 'error', + offset: 300 + }) }) + } else { + var textarea = document.createElement('textarea') + document.body.appendChild(textarea) + // 隐藏此输入框 + textarea.style.position = 'fixed' + textarea.style.clip = 'rect(0 0 0 0)' + textarea.style.top = '10px' + // 赋值 + textarea.value = text + // 选中 + textarea.select() + // 复制 + document.execCommand('copy', true) + // 移除输入框 + document.body.removeChild(textarea) + ElMessage({ + message: t('agent.copySuccess'), + type: 'success', + offset: 300 }) + } } const toggleThinkingCollapsed = () => { @@ -252,6 +275,7 @@