From 5c8546995e92241dfc7437d636d2bfad77901bfd 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: Fri, 13 Jan 2023 10:51:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=8D=E5=88=B6=E6=96=B9?= =?UTF-8?q?=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/components/Navbar.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 6e76ab9..cce89b0 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -58,7 +58,9 @@ import LangSelect from '@/components/LangSelect/index' import useAppStore from '@/store/modules/app' import useUserStore from '@/store/modules/user' import useSettingsStore from '@/store/modules/settings' -import { useClipboard } from '@vueuse/core' +// import { useClipboard } from '@vueuse/core' +import useClipboard from 'vue-clipboard3' +const { toClipboard } = useClipboard() const { proxy } = getCurrentInstance() const appStore = useAppStore() const userStore = useUserStore() @@ -85,13 +87,12 @@ function handleCommand(command) { } } -const { copy, isSupported } = useClipboard() const copyText = async (val) => { - if (isSupported) { - copy(val) + try { + await toClipboard(val) proxy.$modal.msgSuccess('复制成功!') - } else { - alert(val) + } catch (e) { + console.log(e) proxy.$modal.msgError('当前浏览器不支持') } }