bugfix: 多条消息的卡片展示

This commit is contained in:
2026-04-01 16:59:22 +08:00
parent 72cd9d28f2
commit 63313d2d81
4 changed files with 36 additions and 89 deletions

View File

@@ -44,10 +44,7 @@
<img src="@/assets/images/arrow-top-right.png" />
</div>
<!-- 已加载完成的 sketch 显示实际图片 -->
<img
v-img-loading="getImageSrc(item, index)"
@load="handleImageLoad(index)"
/>
<img v-img-loading="getImageSrc(item, index)" @load="handleImageLoad(index)" />
<!-- 正在加载的 sketch 显示 loading gif overlay -->
<!-- <div v-if="pendingSketchIndexes.includes(index)" class="loading-wrapper">
<img src="@/assets/images/sketch-loading.gif" alt="loading" />
@@ -118,8 +115,6 @@
// 存储每个图片的加载状态
const loadedStatus = ref<boolean[]>([])
const props = withDefaults(
defineProps<{
type: 'sketch' | 'report' | 'url'
@@ -187,8 +182,9 @@
sessionId.value = id
}
const setReportTitle = (title: string) => {
const setReport = (title: string, content: string) => {
reportTitle.value = title
markdownContent.value = content
}
const setUrls = async (list: string[]) => {
@@ -196,14 +192,14 @@
const res = await fetchUrlTitle(list)
urlList.value = res
}
watch(
() => sessionId.value,
(newVal) => {
if (newVal) {
markdownContent.value = sessionStorage.getItem(`reportsContent_${newVal}`)
}
}
)
// watch(
// () => sessionId.value,
// (newVal) => {
// if (newVal) {
// markdownContent.value = sessionStorage.getItem(`reportsContent_${newVal}`)
// }
// }
// )
// 图片加载完成时触发
const handleImageLoad = (index: number) => {
@@ -264,15 +260,6 @@
URL.revokeObjectURL(url)
}
const showLoading = ref(false)
const handleLoadingSketch = (sketchIndex?: number) => {
showLoading.value = true
// 记录正在加载的 sketch 索引
// if (sketchIndex !== undefined) {
// pendingSketchIndexes.value.push(sketchIndex)
// }
}
const handleClickUrl = (item: { url: string; title: string }) => {
window.open(item.url, '_blank')
}
@@ -316,17 +303,11 @@
}
}
}
onMounted(() => {
MyEvent.add('loading-sketch', handleLoadingSketch)
})
onUnmounted(() => {
MyEvent.remove('loading-sketch', handleLoadingSketch)
})
defineExpose({
setSessionId,
setUrls,
setReportTitle
setReport
})
</script>