From e85f8edcaad1ffbbdf0f150a00c08530d5032d7b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 27 Apr 2026 08:42:39 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(im):=20=E4=BC=98=E5=8C=96=20Co?= =?UTF-8?q?nversationItem.vue=EF=BC=8C=E5=AF=B9=E9=BD=90=E5=BE=AE=E4=BF=A1?= =?UTF-8?q?=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/im/home/components/ContextMenu.vue | 33 +++-- .../conversation/ConversationItem.vue | 122 +++++++++--------- src/views/im/home/store/groupStore.ts | 7 +- src/views/im/home/store/uiStore.ts | 2 + 4 files changed, 93 insertions(+), 71 deletions(-) diff --git a/src/views/im/home/components/ContextMenu.vue b/src/views/im/home/components/ContextMenu.vue index b98c62ba6..f6d639041 100644 --- a/src/views/im/home/components/ContextMenu.vue +++ b/src/views/im/home/components/ContextMenu.vue @@ -15,15 +15,26 @@ class="fixed min-w-30 py-1 bg-[var(--el-bg-color-overlay)] rounded-md shadow-lg" :style="{ left: adjustedPosition.x + 'px', top: adjustedPosition.y + 'px' }" > -
- {{ item.name }} -
+ @@ -43,12 +54,14 @@ const contextMenu = computed(() => uiStore.contextMenu) * 计算菜单实际渲染坐标:靠近视口右 / 下边缘时回弹,避免菜单被裁剪 * * itemHeight / menuWidth 是和模板里 px-4 py-2 + text-13px / min-w-30 配套的实际尺寸; + * dividerHeight = 9px(my-1 上下各 4 + 1px border),仅非首项的 divided 计入; * menuHeight 额外加 8 是外层 py-1 的上下 padding 之和(4px × 2) */ const adjustedPosition = computed(() => { const items = contextMenu.value.items const itemHeight = 34 - const menuHeight = items.length * itemHeight + 8 + const dividerCount = items.filter((it, i) => it.divided && i > 0).length + const menuHeight = items.length * itemHeight + dividerCount * 9 + 8 const menuWidth = 120 let x = contextMenu.value.position.x let y = contextMenu.value.position.y diff --git a/src/views/im/home/pages/conversation/components/conversation/ConversationItem.vue b/src/views/im/home/pages/conversation/components/conversation/ConversationItem.vue index 6d88f3591..818096e5b 100644 --- a/src/views/im/home/pages/conversation/components/conversation/ConversationItem.vue +++ b/src/views/im/home/pages/conversation/components/conversation/ConversationItem.vue @@ -27,7 +27,6 @@ {{ conversation.name }} - {{ conversation.lastContent }} - - + - - - + /> @@ -73,9 +71,11 @@