Files
danyang-match/miniapp/components/message-bubble/index.js
T

30 lines
899 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 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', {});
},
},
});