feat: 消息ui优化
This commit is contained in:
@@ -523,6 +523,13 @@ function copy(item: any) {
|
|||||||
.catch(() => ElMessage.error('复制失败'));
|
.catch(() => ElMessage.error('复制失败'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查消息是否有有效ID(已保存到后端)
|
||||||
|
*/
|
||||||
|
function hasValidId(item: MessageItem): boolean {
|
||||||
|
return item.id !== undefined && (typeof item.id === 'string' || (typeof item.id === 'number' && item.id > 0));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 进入删除模式(从指定消息开始)
|
* 进入删除模式(从指定消息开始)
|
||||||
* @param item - 触发删除的消息
|
* @param item - 触发删除的消息
|
||||||
@@ -1298,8 +1305,8 @@ onUnmounted(() => {
|
|||||||
<ElIcon><Refresh /></ElIcon>
|
<ElIcon><Refresh /></ElIcon>
|
||||||
</el-button>
|
</el-button>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
<!-- 用户消息:编辑按钮 -->
|
<!-- 用户消息:编辑按钮(仅对有有效ID的消息显示) -->
|
||||||
<el-tooltip v-if="item.role === 'user'" content="编辑" placement="top">
|
<el-tooltip v-if="item.role === 'user' && hasValidId(item)" content="编辑" placement="top">
|
||||||
<el-button text :disabled="isSending" @click="startEditMessage(item)">
|
<el-button text :disabled="isSending" @click="startEditMessage(item)">
|
||||||
<ElIcon><Edit /></ElIcon>
|
<ElIcon><Edit /></ElIcon>
|
||||||
</el-button>
|
</el-button>
|
||||||
@@ -1407,9 +1414,10 @@ onUnmounted(() => {
|
|||||||
&.delete-mode {
|
&.delete-mode {
|
||||||
|
|
||||||
.el-bubble {
|
.el-bubble {
|
||||||
// 删除模式下:用户消息加回 flex:auto
|
// 删除模式下:用户消息加回 flex:auto,并移除 max-width 限制
|
||||||
&[class*="end"] .el-bubble-content-wrapper {
|
&[class*="end"] .el-bubble-content-wrapper {
|
||||||
flex: auto;
|
flex: auto;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除模式下的 content 样式 - 全宽背景
|
// 删除模式下的 content 样式 - 全宽背景
|
||||||
|
|||||||
Reference in New Issue
Block a user