电商组件 / 客服与消息 / cu-shop-chat-bubble 消息气泡
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 / senderObject{}`(必填)
self是否我方,右侧主色气泡booleanfalse
showAvatar显示头像;无 sender.avatar 时用首字回退booleantrue
showTime气泡上方显示 HH:mmbooleanfalse
maxImageWidth图片最大宽(px),高度按 1.25 倍算number200
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

代码示例

uvue
<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。