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()