diff --git a/components/i/search/Header.vue b/components/i/search/Header.vue index 02b3698df38e0f50170694ddabe3995167b5afd9..ed72a665801cd7ce2f362ced64c73e60e13841bc 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