01 / Overview
cu-shop-chat-bubble
单条消息气泡:文本 / 图片 / 商品 / 订单 / 系统提示五种消息体,左右分布。商品与订单只在气泡内画紧凑行,不依赖商品卡与订单卡。
客服与消息
9 条 props
4 事件
已实现
02 / Demo
实时预览
演示页:/pages/shop-order/chat-bubble。右侧的预览由站点脚本把 H5 演示页装进 iframe;数据与交互在演示页内操作,不在此处留静态截图。
依赖
- 基础件:无
- Shop 共享件:
locale/index.uts(cuShopT)、utils/price.uts(formatFen)、store/shop-config.uts(shopCurrencySymbol)
03 / Props · Events · Slots
全量契约
props
| 参数 | 说明 | 类型 | 默认值 |
|---|---|---|---|
| message | 单条 ShopChatMessage,读 type / direction / status / content / imageUrl / goods / order / systemText / createdAt / sender | Object | {}`(必填) |
| self | 是否我方,右侧主色气泡 | boolean | false |
| showAvatar | 显示头像;无 sender.avatar 时用首字回退 | boolean | true |
| showTime | 气泡上方显示 HH:mm | boolean | false |
| maxImageWidth | 图片最大宽(px),高度按 1.25 倍算 | number | 200 |
| customStyle | 根节点自定义样式 | Object | {} |
| customClass | 根节点自定义类名 | string | '' |
| url | 透传字段,本件未接线 | string | '' |
| linkType | 透传字段,本件未接线 | string | 'navigateTo' |
events
| 事件 | 说明 | 载荷 |
|---|---|---|
| @click | 点气泡 | { message } |
| @click-image | 点图片消息,index 当前恒为 0 | { message, index } |
| @retry | 点失败消息左侧「!」 | { message } |
| @long-press | 长按气泡,坐标取最近一次 touchstart 触点 | { message, x, y } |
slots
| 插槽 | 作用域 | 说明 |
|---|---|---|
| default | 无 | 整体替换气泡内消息体 |
| extra | 无 | 气泡下方附加区 |
04 / Example
代码示例
<cu-shop-chat-bubble :message="message" :self="true" :showTime="true" @retry="onRetry" />
05 / Notes
注意事项
气泡最大宽 70%;我方主色底白字,对方白色底主文字,暗黑下全部走变量。
type 缺省按 text 处理;system 消息居中灰底、无头像。
商品行只读 goods.title / goods.imageUrl / goods.priceFen;订单行只读 order.orderNo / order.amounts.payableFen。
长按只 emit,不内置复制菜单、不预览大图;不请求接口、不持久化、不弹 toast。
安装 colorui-shop 全量包与安装任意 cu-shop-* 单件包二选一,不要同时装。单件包的前提是已安装完整 colorui-x。