From 483a7c019c870cc1b1c7d3b4f007a9596080804e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=92?= Date: Wed, 27 Aug 2025 21:15:24 +0800 Subject: [PATCH] 1 --- src/views/system/jd-instruction/index.vue | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/views/system/jd-instruction/index.vue b/src/views/system/jd-instruction/index.vue index 63da940..98ddfcd 100644 --- a/src/views/system/jd-instruction/index.vue +++ b/src/views/system/jd-instruction/index.vue @@ -22,6 +22,9 @@ +
+ 复制响应 +
@@ -43,6 +46,27 @@ export default { } }, methods: { + copyResult() { + if (!this.result) return + const text = this.result + if (navigator.clipboard) { + navigator.clipboard.writeText(text).then(() => { + this.$modal.msgSuccess('复制成功') + }).catch(() => { + this.fallbackCopyText(text) + }) + } else { + this.fallbackCopyText(text) + } + }, + fallbackCopyText(text) { + const ta = document.createElement('textarea') + ta.value = text + document.body.appendChild(ta) + ta.focus(); ta.select() + try { document.execCommand('copy'); this.$modal.msgSuccess('复制成功') } catch (e) { this.$modal.msgError('复制失败') } + document.body.removeChild(ta) + }, run() { const cmd = (this.form.command || '').trim() if (!cmd) { this.$modal.msgError('请输入指令'); return }