From 43743ebe546eebd3fb9692aef15fc82f111c9669 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com>
Date: Sun, 5 Jun 2022 18:07:31 +0800
Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8vueuse=E5=AE=9E=E7=8E=B0?=
=?UTF-8?q?=E5=9C=A8dialog=E4=B8=ADcopy=E5=8A=9F=E8=83=BD?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/views/tool/file/index.vue | 19 +++++++++++--------
src/views/tool/gen/index.vue | 18 +++++++++++-------
2 files changed, 22 insertions(+), 15 deletions(-)
diff --git a/src/views/tool/file/index.vue b/src/views/tool/file/index.vue
index 20127ee..e78952d 100644
--- a/src/views/tool/file/index.vue
+++ b/src/views/tool/file/index.vue
@@ -173,9 +173,9 @@
{{ formView.accessUrl }}
-
+
@@ -188,7 +188,7 @@
diff --git a/src/views/tool/gen/index.vue b/src/views/tool/gen/index.vue
index 24eb182..da7af65 100644
--- a/src/views/tool/gen/index.vue
+++ b/src/views/tool/gen/index.vue
@@ -62,9 +62,7 @@
-
+ 复制
@@ -79,7 +77,7 @@ import { useRouter } from 'vue-router'
import importTable from './importTable'
import hljs from 'highlight.js'
import 'highlight.js/styles/dark.css' // 这里有多个样式,自己可以根据需要切换
-
+import { useClipboard } from '@vueuse/core'
// const route = useRoute()
const router = useRouter()
const { proxy } = getCurrentInstance()
@@ -241,9 +239,15 @@ function highlightedCode(code, key) {
const result = hljs.highlightAuto(code || '')
return result.value || ' '
}
-/** 复制代码成功 */
-function clipboardSuccess() {
- proxy.$modal.msgSuccess('复制成功')
+
+const { copy, isSupported } = useClipboard()
+function onCopy(input) {
+ if (isSupported) {
+ copy(input)
+ proxy.$modal.msgSuccess('复制成功!')
+ } else {
+ proxy.$modal.msgError('当前浏览器不支持')
+ }
}
getList()