ChatBubble (消息气泡)

Telegram 式消息气泡:自己的靠右用主色阶,别人的靠左;回复与部分引用预览、照片与相册拼图(点击进灯箱)、跨站上下文卡片、回应条,右下角时间 / 已编辑 / 发送状态,失败可重试;服务消息是居中的小胶囊。

通常由 KunChatMessageList 渲染并排好位置;单独使用时自己决定左右对齐。

基础用法与连续消息

雪之下小春:
在吗在吗
雪之下小春:
你之前说的那个补丁我装上了
雪之下小春:
但是一进游戏就乱码,是不是要转区?
你:
对,用 Locale Emulator 转区再开就好了
已编辑
Basic.vue

回复与引用

雪之下小春:
最后那个反转你猜到了吗?原来列车长就是白本人
你:
猜到一半,第三章那封信就有暗示了
你:
这句我也没想到
雪之下小春:
那条我删了哈哈
Reply.vue

照片与相册

雪之下小春:
雪之下小春:
片头曲好好听,这张是开场动画的截图
雪之下小春:
通关了!最喜欢的五张 CG
Media.vue

发送状态

你:
正在发送的消息
你:
已送达,对方还没看
你:
对方已读
你:
网络断了,没发出去
Status.vue

回应

樱小路露娜:
第三章校对完成,辛苦大家!
Reactions.vue

服务消息与上下文卡片

你 创建了群组「Galgame 汉化交流」
你 邀请了 雪之下小春、Ayase和樱小路露娜
樱小路露娜 将群名改为「汉化交流 · 校对组」
已注销用户 退出了群组
雪之下小春:www.moyu.moe《星空鉄道とシロの旅》汉化补丁 v0.9
这个补丁的汉化是完整的吗?
Service.vue

属性

属性类型默认值说明
message *KunChatMessage—The message. For an album, the one it acts as (reactions, replies).
albumKunChatMessage[] | nullnullEvery photo of an album, in order; omitted for anything else.
currentUserIdstring—The viewer's id, so a service message can say "you".
disabledbooleanfalseSwallow clicks on the sender, reply and reactions, e.g. under a selection mode.
lightboxbooleantrueOpen photos in a built-in KunLightbox on click. The message list turns this off and shows every loaded photo in one lightbox instead.
ownbooleanfalseSent by the viewer: right-aligned, in the primary tint.
positionKunChatBubblePosition"single"Where the bubble sits in its sender's run: it rounds the corners on the sender's side, and `single` / `last` draw the tail.
reactionOptionsKunChatReactionOption[][]The reaction vocabulary, to draw each reaction key.
resolveMediaUrlKunChatMediaUrlResolver—Required to show photos.
resolveMessage((seq: number) => KunChatMessage)—Finds a loaded message by seq — the text a "pinned a message" service line quotes.
showSenderbooleanfalseShow the sender's name on top: group chats, first of a run.
statusKunChatSendStatus—Delivery state of an own message. The clock / tick / double tick at the bottom corner; `failed` is a button that emits `retry`.
timeZonestring—IANA zone for the timestamp. Pass it when server-rendering, or the server's zone and the reader's disagree and hydration mismatches.
usersKunChatUser[][]Users the message refers to — its sender, a reply's sender, a service message's actors. A missing or `deleted` user shows as deleted.

事件

事件回调参数说明
linkurl: string, event: MouseEventA link in the text or the context card was clicked.
mentionuserId: string, event: MouseEventA mention in the text was clicked.
photo-clickindex: numberA photo was clicked (index into the album). Fires with `lightbox` on as well.
reactreaction: string | nullA reaction chip was clicked: the key to set, or null to remove the viewer's own. One reaction per person, so setting replaces.
reply-clickseq: numberThe reply preview was clicked: jump to the replied-to message.
retry—The failed-status button was clicked.
user-clickuserId: string, event: MouseEventThe sender's name was clicked. It links to the profile unless you call `event.preventDefault()`.