feat: 对话页面的消息样式兼容调整

This commit is contained in:
2026-05-12 15:50:41 +08:00
parent 0dc18bc9a5
commit f0b6e86e64
5 changed files with 62 additions and 35 deletions

View File

@@ -1,4 +1,6 @@
<template>
<!-- 外层行容器接收来自父组件的对齐类 flex flex-justify-start并占满宽度 -->
<view class="chat-ai-row">
<view class="container">
<view class="chat-ai">
<view class="container-content">
@@ -15,6 +17,7 @@
</view>
<slot name="footer"></slot>
</view>
</view>
</template>
<script setup>

View File

@@ -1,19 +1,30 @@
.container {
.chat-ai-row {
width: 100%;
box-sizing: border-box;
display: flex;
flex-direction: column;
max-width: 100%; // ✅ 限制最大宽度
overflow-x: hidden; // ✅ 防止横向撑开
padding-bottom: 12px;
align-items: center; /* 垂直居中气泡 */
justify-content: flex-start; /* 默认左对齐 */
}
.chat-ai {
.container {
/* 气泡容器:内联块按内容自适应 */
display: inline-block;
box-sizing: border-box;
vertical-align: middle;
width: auto;
max-width: 100%;
overflow-x: hidden;
}
.chat-ai {
margin: 6px 0;
padding: 0 12px; // 消息内容的内边距 左右20px
min-width: 100px;
max-width: 100%; // ✅ 限制最大宽度
overflow: hidden; // ✅ 超出内容被切掉
word-wrap: break-word; // ✅ 长单词自动换行
word-break: break-all; // ✅ 强制换行
}
padding: 0 12px; // 消息内容的内边距 左右12px
min-width: 0;
width: auto;
max-width: 100%;
overflow: hidden;
word-wrap: break-word;
word-break: break-all;
}
.container-content {

View File

@@ -1,8 +1,11 @@
<template>
<!-- 外层行容器接收来自父组件的对齐类 flex flex-justify-end -->
<view class="chat-mine-row">
<view class="chat-mine bg-17294E">
<text class="font-size-15 color-white">{{ text }}</text>
<slot></slot>
</view>
</view>
</template>
<script setup>

View File

@@ -1,10 +1,20 @@
.chat-mine-row {
width: 100%;
box-sizing: border-box;
display: flex;
justify-content: flex-end;
}
.chat-mine {
margin: 0 12px 6px;
padding: 8px 16px;
border-radius: 15px;
display: flex;
flex-direction: column;
max-width: 100%; // ✅ 限制最大宽度
overflow-x: hidden; // ✅ 防止横向撑开
/* 气泡为内联块,按内容宽度自适应;外层 `.chat-mine-row` 控制排列 */
display: inline-block;
box-sizing: border-box;
vertical-align: top;
width: auto;
max-width: 100%;
overflow-x: hidden;
}

View File

@@ -1,5 +1,5 @@
<template>
<view class="w-full">
<view class="w-full pb-12">
<template v-if="toolCall.picture && toolCall.picture.length > 0">
<ModuleTitle :title="图片详情" />
<ImageSwiper :images="toolCall.picture" thumbnailBottom="12px" />