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

delte thread

上级 f784bed9
...@@ -38,6 +38,7 @@ ...@@ -38,6 +38,7 @@
<IActionThread <IActionThread
:collection_id="thread.collections.length ? thread.collections[0].collection_id : ''" :collection_id="thread.collections.length ? thread.collections[0].collection_id : ''"
:c_id="item.c_id" :c_id="item.c_id"
@delete="handleDeletedThread"
/> />
</div> </div>
</div> </div>
...@@ -57,6 +58,7 @@ const props = defineProps({ ...@@ -57,6 +58,7 @@ const props = defineProps({
default: false default: false
} }
}) })
const emit = defineEmits(['delete'])
const thread = computed(() => { const thread = computed(() => {
if (!props.isItem) return props.item if (!props.isItem) return props.item
else { else {
...@@ -97,4 +99,7 @@ watch(()=> Layout.selectCollectData, (data) => { ...@@ -97,4 +99,7 @@ watch(()=> Layout.selectCollectData, (data) => {
watch(()=> Layout.removeCollectData, (data) => { watch(()=> Layout.removeCollectData, (data) => {
if (data.value !== null) handleRemoveCollect(data) if (data.value !== null) handleRemoveCollect(data)
}, { deep: true }) }, { deep: true })
function handleDeletedThread () {
emit('delete', thread.value.c_id)
}
</script> </script>
\ No newline at end of file
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
:item="item" :item="item"
:key="item.id" :key="item.id"
is-item is-item
@delete="handleDeletedThread"
/> />
</div> </div>
</div> </div>
...@@ -43,4 +44,8 @@ async function findCollectionData() { ...@@ -43,4 +44,8 @@ async function findCollectionData() {
} }
await findCollectionData() await findCollectionData()
await $getCollection() 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)
}
</script> </script>
\ No newline at end of file
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
v-for="item in threads" v-for="item in threads"
:item="item" :item="item"
:key="item.c_id" :key="item.c_id"
@delete="handleDeletedThread"
/> />
</div> </div>
</div> </div>
...@@ -51,4 +52,9 @@ async function getThreadData() { ...@@ -51,4 +52,9 @@ async function getThreadData() {
} }
await getThreadData() await getThreadData()
await $getCollection() 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)
}
</script> </script>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册