89 lines
1.6 KiB
Vue
89 lines
1.6 KiB
Vue
<template>
|
|
<div class="chat-list">
|
|
<div v-for="msg in messages" :key="msg.id" class="message-row" :class="{ 'is-user': msg.isUser }">
|
|
<div class="bubble-wrap">
|
|
<div class="bubble">{{ msg.content }}</div>
|
|
<div class="time">{{ msg.time }}</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
interface ChatMessage {
|
|
id: string;
|
|
content: string;
|
|
time: string;
|
|
isUser: boolean;
|
|
}
|
|
|
|
interface Props {
|
|
messages: ChatMessage[];
|
|
}
|
|
|
|
defineProps<Props>();
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.chat-list {
|
|
height: 100%;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: flex-start;
|
|
gap: 16px;
|
|
padding: 28px 0 10px;
|
|
}
|
|
|
|
.message-row {
|
|
display: flex;
|
|
align-items: flex-start;
|
|
gap: 12px;
|
|
max-width: 100%;
|
|
|
|
&.is-user {
|
|
justify-content: flex-end;
|
|
}
|
|
}
|
|
|
|
.bubble-wrap {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 5px;
|
|
max-width: min(84%, 1120px);
|
|
}
|
|
|
|
.bubble {
|
|
font-size: 14px;
|
|
line-height: 1.75;
|
|
padding: 14px 16px;
|
|
border-radius: 16px;
|
|
word-break: break-word;
|
|
color: #1f2937;
|
|
background: linear-gradient(135deg, rgba(255, 255, 255, 0.96) 0%, rgba(248, 250, 255, 0.92) 100%);
|
|
border: 1px solid rgba(226, 233, 244, 0.95);
|
|
backdrop-filter: blur(8px);
|
|
box-shadow: 0 4px 16px rgba(15, 23, 42, 0.05);
|
|
|
|
.message-row.is-user & {
|
|
background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
|
|
border-color: rgba(59, 130, 246, 0.4);
|
|
color: #fff;
|
|
box-shadow: 0 8px 24px rgba(37, 99, 235, 0.35);
|
|
}
|
|
}
|
|
|
|
.time {
|
|
font-size: 11px;
|
|
color: #8f9aae;
|
|
padding: 4px 6px;
|
|
|
|
.message-row.is-user & {
|
|
text-align: right;
|
|
color: rgba(148, 163, 184, 0.9);
|
|
}
|
|
.message-row:not(.is-user) & {
|
|
padding-left: 2px;
|
|
}
|
|
}
|
|
</style>
|