diff --git a/components/i/search/Header.vue b/components/i/search/Header.vue index 9e3e01b2508bf4370c67e01c5a3113c01f30f918..02b3698df38e0f50170694ddabe3995167b5afd9 100644 --- a/components/i/search/Header.vue +++ b/components/i/search/Header.vue @@ -100,11 +100,6 @@ function handleBlurTitle () { } function handleShare (isUpdate) { const shareType = String(isOpen.value) - toast.add({ - icon: 'i-heroicons-information-circle-20-solid', - timeout: 2000, - title: '链接已复制到剪贴板' - }) isUpdate && useRequest(`/v1/chat/${route.params.id}/public/${shareType}`, { method: 'post' }) } @@ -114,9 +109,18 @@ function handleUpdateOpenState (state) { handleShare(updateOpened) } function handleSetOpenState() { + useCopyToClipboard().copy(window.location.href) + const isUpdate = !isOpen.value if (!isOpen.value) { isOpen.value = true - handleShare(true) } + setTimeout(() => { + toast.add({ + icon: 'i-heroicons-information-circle-20-solid', + timeout: 2000, + title: '链接已复制到剪贴板' + }) + handleShare(isUpdate) + }, 500) } \ No newline at end of file