diff --git a/components/i/library/Thread.vue b/components/i/library/Thread.vue index 3bd3e7075b069c29987aec17862caa4e89a0ab00..bc55115be6a98f5bb499818655bab8f989515102 100644 --- a/components/i/library/Thread.vue +++ b/components/i/library/Thread.vue @@ -38,6 +38,7 @@ @@ -57,6 +58,7 @@ const props = defineProps({ default: false } }) +const emit = defineEmits(['delete']) const thread = computed(() => { if (!props.isItem) return props.item else { @@ -97,4 +99,7 @@ watch(()=> Layout.selectCollectData, (data) => { watch(()=> Layout.removeCollectData, (data) => { if (data.value !== null) handleRemoveCollect(data) }, { deep: true }) +function handleDeletedThread () { + emit('delete', thread.value.c_id) +} \ No newline at end of file diff --git a/pages/library/[id].vue b/pages/library/[id].vue index 6e9a3718c8dd557b036363962ec0205d5db69ee9..c1dd18450570d6db048f97b2555d037975200bbd 100644 --- a/pages/library/[id].vue +++ b/pages/library/[id].vue @@ -15,6 +15,7 @@ :item="item" :key="item.id" is-item + @delete="handleDeletedThread" /> @@ -43,4 +44,8 @@ async function findCollectionData() { } await findCollectionData() await $getCollection() +function handleDeletedThread (c_id) { + const findIndex = themesTagList.value.findIndex(i => i.c_id === c_id) + if (findIndex >= 0) themesTagList.value.splice(findIndex, 1) +} \ No newline at end of file diff --git a/pages/library/index.vue b/pages/library/index.vue index 6a97bc236cc23ec23e5e97441d39f340f00f9d36..06c89124a318abcbc189cff50877e8ade6d889e9 100644 --- a/pages/library/index.vue +++ b/pages/library/index.vue @@ -9,6 +9,7 @@ v-for="item in threads" :item="item" :key="item.c_id" + @delete="handleDeletedThread" /> @@ -51,4 +52,9 @@ async function getThreadData() { } await getThreadData() await $getCollection() + +function handleDeletedThread (c_id) { + const findIndex = threads.value.findIndex(i => i.c_id === c_id) + if (findIndex >= 0) threads.value.splice(findIndex, 1) +}