From a0f9baa4887f1e6f19e28879c6612516826b450f Mon Sep 17 00:00:00 2001 From: DebugIsFalse <511418503@qq.com> Date: Tue, 28 May 2024 17:55:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=88=86=E4=BA=AB=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/i/search/Header.vue | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/components/i/search/Header.vue b/components/i/search/Header.vue index 02b3698..ed72a66 100644 --- a/components/i/search/Header.vue +++ b/components/i/search/Header.vue @@ -100,7 +100,7 @@ function handleBlurTitle () { } function handleShare (isUpdate) { const shareType = String(isOpen.value) - isUpdate && useRequest(`/v1/chat/${route.params.id}/public/${shareType}`, { method: 'post' }) + return isUpdate && useRequest(`/v1/chat/${route.params.id}/public/${shareType}`, { method: 'post' }) } function handleUpdateOpenState (state) { @@ -109,18 +109,19 @@ function handleUpdateOpenState (state) { handleShare(updateOpened) } function handleSetOpenState() { - useCopyToClipboard().copy(window.location.href) const isUpdate = !isOpen.value - if (!isOpen.value) { - isOpen.value = true - } - setTimeout(() => { + setTimeout(async () => { + if (!isOpen.value) { + await handleShare(isUpdate) + } + if (!isOpen.value) { + isOpen.value = true + } toast.add({ icon: 'i-heroicons-information-circle-20-solid', timeout: 2000, title: '链接已复制到剪贴板' }) - handleShare(isUpdate) }, 500) } \ No newline at end of file -- GitLab