提交 c88dce72 编写于 作者: D DebugIsFalse

fix: select

上级 def2ec68
...@@ -67,6 +67,9 @@ async function getCollectionData () { ...@@ -67,6 +67,9 @@ async function getCollectionData () {
collection.value = await getCollection() collection.value = await getCollection()
} }
async function handleSelected(id) { async function handleSelected(id) {
if (selectedCollection.value.includes(id)) {
await deleteCollectionRecord(id, $selectThreadId.value)
}
selectedCollection.value = [id] selectedCollection.value = [id]
$setSelectCollectionId(selectedCollection.value) $setSelectCollectionId(selectedCollection.value)
const { error } = await saveCollection({ collection_id: id, c_id: $selectThreadId.value }) const { error } = await saveCollection({ collection_id: id, c_id: $selectThreadId.value })
......
...@@ -12,19 +12,14 @@ ...@@ -12,19 +12,14 @@
:model-value="editTitle" :model-value="editTitle"
@blur="handleBlurTitle" @blur="handleBlurTitle"
/> />
<span>/</span> </div>
<div class="flex gap-2">
<UButton <UButton
color="gray" @click="handleOpenSelect"
variant="ghost" color="gray" variant="ghost"
leading-icon="i-heroicons-plus-20-solid" leading-icon="i-heroicons-plus-20-solid"
:label="$selectCollectionId.length > 0 ? '已收藏' : '收藏'" :label="$selectCollectionId.length > 0 ? '已收藏' : '收藏'"
@click="handleOpenSelect"
/> />
</div>
<div class="flex gap-2">
<ClientOnly>
<UButton v-if="SM" @click="handleSave" color="gray" variant="ghost" leading-icon="i-heroicons-plus-20-solid">收藏</UButton>
</ClientOnly>
<UPopover v-model:open="isShareOpen"> <UPopover v-model:open="isShareOpen">
<UButton :leading-icon="isOpen ? 'i-heroicons-share-20-solid' : 'i-heroicons-lock-closed-20-solid'" @click="handleSetOpenState">分享</UButton> <UButton :leading-icon="isOpen ? 'i-heroicons-share-20-solid' : 'i-heroicons-lock-closed-20-solid'" @click="handleSetOpenState">分享</UButton>
<template #panel> <template #panel>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册