优化时间显示
This commit is contained in:
@@ -180,7 +180,8 @@
|
||||
|
||||
<div class="message-content">
|
||||
<div class="message-time">
|
||||
{{ message.time }}
|
||||
{{ getTime(message.time) }}
|
||||
<!-- {{ message.time }} -->
|
||||
</div>
|
||||
|
||||
<div class="message-bubble">
|
||||
@@ -468,6 +469,18 @@ export default {
|
||||
}
|
||||
},
|
||||
|
||||
getTime(time) {
|
||||
if (!time) return "";
|
||||
|
||||
const date = new Date(time);
|
||||
return `${date.getFullYear()}年${String(date.getMonth() + 1).padStart(
|
||||
2,
|
||||
"0"
|
||||
)}月${String(date.getDate()).padStart(2, "0")}日 ${String(
|
||||
date.getHours()
|
||||
).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
|
||||
},
|
||||
|
||||
// 更新最近消息列表
|
||||
updateRecentChat(messageType, contactName, newMessage) {
|
||||
const index = this.recentChats.findIndex(
|
||||
|
||||
Reference in New Issue
Block a user