提交 a0f9baa4 编写于 作者: D DebugIsFalse

fix: 分享问题

上级 e85edd51
...@@ -100,7 +100,7 @@ function handleBlurTitle () { ...@@ -100,7 +100,7 @@ function handleBlurTitle () {
} }
function handleShare (isUpdate) { function handleShare (isUpdate) {
const shareType = String(isOpen.value) 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) { function handleUpdateOpenState (state) {
...@@ -109,18 +109,19 @@ function handleUpdateOpenState (state) { ...@@ -109,18 +109,19 @@ function handleUpdateOpenState (state) {
handleShare(updateOpened) handleShare(updateOpened)
} }
function handleSetOpenState() { function handleSetOpenState() {
useCopyToClipboard().copy(window.location.href)
const isUpdate = !isOpen.value const isUpdate = !isOpen.value
setTimeout(async () => {
if (!isOpen.value) {
await handleShare(isUpdate)
}
if (!isOpen.value) { if (!isOpen.value) {
isOpen.value = true isOpen.value = true
} }
setTimeout(() => {
toast.add({ toast.add({
icon: 'i-heroicons-information-circle-20-solid', icon: 'i-heroicons-information-circle-20-solid',
timeout: 2000, timeout: 2000,
title: '链接已复制到剪贴板' title: '链接已复制到剪贴板'
}) })
handleShare(isUpdate)
}, 500) }, 500)
} }
</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.
先完成此消息的编辑!
想要评论请 注册