提交 6ebddb44 编写于 作者: D DebugIsFalse

Update Header.vue

上级 a062186f
...@@ -92,20 +92,20 @@ function handleBlurTitle () { ...@@ -92,20 +92,20 @@ function handleBlurTitle () {
isEditTitle.value = false isEditTitle.value = false
emits('update-query', editTitle.value) emits('update-query', editTitle.value)
} }
async function handleShare () { function handleShare (isUpdate) {
const shareType = String(isOpen.value) const shareType = String(isOpen.value)
const { error } = await useRequest(`/v1/chat/${route.params.id}/public/${shareType}`, { method: 'post' }) useCopyToClipboard().copy(window.location.href)
if (!error.value && isOpen.value) { toast.add({
useCopyToClipboard().copy(window.location.href) icon: 'i-heroicons-information-circle-20-solid',
toast.add({ timeout: 2000,
icon: 'i-heroicons-information-circle-20-solid', title: '链接已复制到剪贴板'
timeout: 2000, })
title: '链接已复制到剪贴板' isUpdate && useRequest(`/v1/chat/${route.params.id}/public/${shareType}`, { method: 'post' })
})
}
} }
function handleUpdateOpenState (state) { function handleUpdateOpenState (state) {
const updateOpened = isOpen.value !== state
isOpen.value = state isOpen.value = state
handleShare() handleShare(updateOpened)
} }
</script> </script>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册