30 lines
899 B
JavaScript
30 lines
899 B
JavaScript
/**
|
||
* MessageBubble 聊天气泡(规范 §61-63)
|
||
*
|
||
* bubbleType: self / other / system
|
||
* self:右对齐,主红气泡
|
||
* other:左对齐,白色气泡
|
||
* system:居中,灰色文字(如"成功牵手"系统提示)
|
||
*
|
||
* 失败状态:sendStatus='failed' 时显示重试图标。
|
||
*/
|
||
Component({
|
||
options: { addGlobalClass: true },
|
||
properties: {
|
||
bubbleType: { type: String, value: 'other' },
|
||
content: { type: String, value: '' },
|
||
sentAt: { type: Number, value: 0 },
|
||
sentAtText: { type: String, value: '' },
|
||
avatarUrl: { type: String, value: '' },
|
||
showAvatar: { type: Boolean, value: true },
|
||
showTime: { type: Boolean, value: false },
|
||
sendStatus: { type: String, value: 'sent' }, // sending|sent|failed
|
||
},
|
||
methods: {
|
||
onRetry() {
|
||
if (this.data.sendStatus !== 'failed') return;
|
||
this.triggerEvent('retry', {});
|
||
},
|
||
},
|
||
});
|