ChatConversationItem (对话列表项)
对话列表的一行:头像、标题、时间与发送状态,预览行依次显示「正在输入…」、草稿或最后一条消息;未读角标(静音置灰)、@ 角标、置顶标记、选中态;触屏左右滑出站点给的操作。
各种状态
未读与 @ 角标、静音置灰、置顶图钉、「正在输入…」、草稿、最后一条是自己发的(带送达状态)、 已注销的对方、选中态。传 href 时整行是链接,否则是按钮。
Basic.vue
滑动操作
在触屏上左右滑动这一行Swipe.vue
属性
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| avatar | string | null | null | Avatar URL, e.g. a group photo. Defaults to `user`'s. |
| currentUserId | string | — | The viewer's id, so a service message can say "you". |
| draft | KunChatFormattedText | null | null | An unsent draft replaces the preview with "草稿:…". |
| href | string | — | Render the row as a link. Without it the row is a button. |
| kind | KunChatKind | "direct" | A group prefixes the preview with its sender and names who is typing; a direct chat does neither. |
| lastMessage | KunChatMessage | null | null | The newest message, previewed on the second line. |
| lastMessageSender | string | null | null | Who sent `lastMessage`, as the preview prefix ("你:", "鲲:"). Omitted in a direct chat for the other side's messages. |
| leadingActions | KunChatSwipeAction[] | [] | Revealed by swiping right on a touch screen. |
| markedUnread | boolean | false | "Mark as unread" was used: a badge with no number. |
| mentionCount | number | 0 | Unread mentions: an @ badge. |
| muted | boolean | false | A muted conversation's badge is grey. |
| pinned | boolean | false | A pin icon where the badge would be. |
| selected | boolean | false | The open conversation. |
| status | KunChatSendStatus | — | Delivery state of `lastMessage` when the viewer sent it. |
| time | string | number | Date | null | null | Defaults to `lastMessage.created_at`. |
| timeZone | string | — | IANA zone for times and day boundaries. Pass it when server-rendering, or the server's zone and the reader's disagree and hydration mismatches. |
| title | string | — | Row title. Defaults to `user`'s name. |
| trailingActions | KunChatSwipeAction[] | [] | Revealed by swiping left on a touch screen. |
| typing | KunChatTypingEvent[] | [] | Typing notifications; while one is live it replaces the preview. |
| unreadCount | number | 0 | Unread messages; the badge caps at 999+. |
| user | KunChatUser | null | null | The other person of a direct chat: title, avatar and deleted state. |
| users | KunChatUser[] | [] | Users, to name who is typing in a group and who acted in a service message. |
事件
| 事件 | 回调参数 | 说明 |
|---|---|---|
| action | key: string | A swipe action was tapped. |
| click | event: MouseEvent | The row was activated. With `href` it also navigates. |