为MessageCard组件添加图片加载事件,更新MessageView以处理图片加载完成后的滚动事件

This commit is contained in:
jxxghp
2025-06-15 07:59:35 +08:00
parent 17ee5f456a
commit 9c386f8533
2 changed files with 10 additions and 1 deletions

View File

@@ -97,6 +97,11 @@ function compareTime(time1: string, time2: string) {
return new Date(time1.replaceAll(/-/g, '/')).getTime() - new Date(time2.replaceAll(/-/g, '/')).getTime()
}
// 图片加载完成
function handleImageLoad() {
emit('scroll')
}
onMounted(() => {
// 组件挂载后触发一次滚动事件
nextTick(() => {
@@ -130,7 +135,7 @@ onBeforeUnmount(() => {
:class="msg.action == 1 ? 'flex-row align-start' : 'flex-row-reverse align-end'"
>
<div class="d-inline-flex flex-column" :class="msg.action == 1 ? 'align-start' : 'align-end'">
<MessageCard :message="msg" />
<MessageCard :message="msg" @imageload="handleImageLoad" />
</div>
</div>
</div>