💄 Optimize attachment list

This commit is contained in:
2025-11-05 23:42:10 +08:00
parent 412ebbd083
commit f851bcd646
5 changed files with 256 additions and 103 deletions

View File

@@ -20,16 +20,11 @@
<div v-html="htmlContent" />
</article>
<div
v-if="props.item.attachments.length > 0"
class="d-flex gap-2 flex-wrap"
@click.stop
>
<attachment-item
v-for="attachment in props.item.attachments"
:key="attachment.id"
:item="attachment"
/>
<attachment-list :attachments="props.item.attachments" :max-height="640" />
<div v-if="props.item.isTruncated" class="flex gap-2 text-xs opacity-80">
<v-icon icon="mdi-dots-horizontal" size="small" />
<p>Post truncated, tap to see details...</p>
</div>
<!-- Post Reactions -->
@@ -53,7 +48,7 @@ import { useMarkdownProcessor } from "~/composables/useMarkdownProcessor"
import type { SnPost } from "~/types/api"
import PostHeader from "./PostHeader.vue"
import AttachmentItem from "./AttachmentItem.vue"
import AttachmentList from "./AttachmentList.vue"
import PostReactionList from "./PostReactionList.vue"
const props = defineProps<{ item: SnPost }>()
@@ -66,14 +61,13 @@ const { render } = useMarkdownProcessor()
const htmlContent = ref<string>("")
function handleReaction(symbol: string, attitude: number, delta: number) {
emit('react', symbol, attitude, delta)
emit("react", symbol, attitude, delta)
}
watch(
props.item,
(value) => {
if (value.content)
htmlContent.value = render(value.content)
if (value.content) htmlContent.value = render(value.content)
},
{ immediate: true, deep: true }
)