ChatConversationItem (对话列表项)

对话列表的一行:头像、标题、时间与发送状态,预览行依次显示「正在输入…」、草稿或最后一条消息;未读角标(静音置灰)、@ 角标、置顶标记、选中态;触屏左右滑出站点给的操作。

各种状态

未读与 @ 角标、静音置灰、置顶图钉、「正在输入…」、草稿、最后一条是自己发的(带送达状态)、 已注销的对方、选中态。传 href 时整行是链接,否则是按钮。

Basic.vue

滑动操作

在触屏上左右滑动这一行
Swipe.vue

属性

属性类型默认值说明
avatarstring | nullnullAvatar URL, e.g. a group photo. Defaults to `user`'s.
currentUserIdstring—The viewer's id, so a service message can say "you".
draftKunChatFormattedText | nullnullAn unsent draft replaces the preview with "草稿:…".
hrefstring—Render the row as a link. Without it the row is a button.
kindKunChatKind"direct"A group prefixes the preview with its sender and names who is typing; a direct chat does neither.
lastMessageKunChatMessage | nullnullThe newest message, previewed on the second line.
lastMessageSenderstring | nullnullWho sent `lastMessage`, as the preview prefix ("你:", "鲲:"). Omitted in a direct chat for the other side's messages.
leadingActionsKunChatSwipeAction[][]Revealed by swiping right on a touch screen.
markedUnreadbooleanfalse"Mark as unread" was used: a badge with no number.
mentionCountnumber0Unread mentions: an @ badge.
mutedbooleanfalseA muted conversation's badge is grey.
pinnedbooleanfalseA pin icon where the badge would be.
selectedbooleanfalseThe open conversation.
statusKunChatSendStatus—Delivery state of `lastMessage` when the viewer sent it.
timestring | number | Date | nullnullDefaults to `lastMessage.created_at`.
timeZonestring—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.
titlestring—Row title. Defaults to `user`'s name.
trailingActionsKunChatSwipeAction[][]Revealed by swiping left on a touch screen.
typingKunChatTypingEvent[][]Typing notifications; while one is live it replaces the preview.
unreadCountnumber0Unread messages; the badge caps at 999+.
userKunChatUser | nullnullThe other person of a direct chat: title, avatar and deleted state.
usersKunChatUser[][]Users, to name who is typing in a group and who acted in a service message.

事件

事件回调参数说明
actionkey: stringA swipe action was tapped.
clickevent: MouseEventThe row was activated. With `href` it also navigates.