提交 e53943f7 编写于 作者: View Design's avatar View Design

222

上级 5c8e8b81
...@@ -9,6 +9,10 @@ ...@@ -9,6 +9,10 @@
<ILibraryEdit :id="id" ref="refEdit" /> <ILibraryEdit :id="id" ref="refEdit" />
</template> </template>
<script setup> <script setup>
import { IConfirm } from '#components'
const { deleteCollection } = useCollectionRequest()
const emit = defineEmits(['delete'])
const modal = useModal()
const props = defineProps({ const props = defineProps({
id: { id: {
type: [String, Number], type: [String, Number],
...@@ -26,7 +30,10 @@ const actionItems = [ ...@@ -26,7 +30,10 @@ const actionItems = [
}, },
{ {
label: '删除合集', label: '删除合集',
icon: 'i-heroicons-trash' icon: 'i-heroicons-trash',
click: () => {
handleOpenDelete()
}
} }
] ]
] ]
...@@ -34,4 +41,18 @@ const refEdit = ref(null) ...@@ -34,4 +41,18 @@ const refEdit = ref(null)
function handleOpen () { function handleOpen () {
refEdit.value.open() refEdit.value.open()
} }
function handleOpenDelete () {
modal.open(IConfirm, {
title: '删除确认',
description: '确定要删除该合集吗?',
async onSuccess() {
modal.close()
await deleteCollection(props.id)
emit('delete')
},
onCancel () {
modal.close()
}
})
}
</script> </script>
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</UDropdown> </UDropdown>
</template> </template>
<script setup> <script setup>
import { IConfirm } from '#components'; import { IConfirm } from '#components'
const { $openLibrarySelect, $getCollection } = useLibraryStore() const { $openLibrarySelect, $getCollection } = useLibraryStore()
const { deleteCollectionRecord, deleteThread } = useCollectionRequest() const { deleteCollectionRecord, deleteThread } = useCollectionRequest()
const Layout = inject('Layout') const Layout = inject('Layout')
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
</div> </div>
<div class="flex flex-grow justify-end items-center gap-4"> <div class="flex flex-grow justify-end items-center gap-4">
<div class="flex"> <div class="flex">
<IActionCollect :id="collectId" /> <IActionCollect :id="collectId" v-if="collect" />
</div> </div>
<div class="flex"> <div class="flex">
<UInput <UInput
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册