feat(ai-chat): 动态切换输入框 placeholder 文案,支持语音和媒体附件提示
This commit is contained in:
@@ -472,7 +472,7 @@
|
||||
ref="messageInput"
|
||||
v-model="inputText"
|
||||
class="message-input"
|
||||
placeholder="发消息或按住说话"
|
||||
:placeholder="inputPlaceholder"
|
||||
placeholder-class="message-input-placeholder"
|
||||
:maxlength="chatUiConfig.ui_input_max_length"
|
||||
:auto-height="true"
|
||||
@@ -885,6 +885,23 @@ export default {
|
||||
if (this.voiceHoldCancelling) return this.$lang('ai-chat.index.releaseToCancel')
|
||||
if (this.voiceHolding) return this.$lang('ai-chat.index.releaseToSend')
|
||||
return this.$lang('ai-chat.index.holdToTalk')
|
||||
},
|
||||
// PR-INPUT-PLACEHOLDER-DYNAMIC (2026-09-28): 输入框 placeholder 按上下文动态切换
|
||||
// - 有待发语音附件 → 提示"给语音加说明"
|
||||
// - 有待发图片/文件/视频附件 → 提示"添加文字说明"
|
||||
// - 默认态 → 提示"发消息或按住说话"
|
||||
// 优先级: 语音 > 其他媒体 > 默认
|
||||
inputPlaceholder() {
|
||||
const files = this.pendingFiles || []
|
||||
const hasAudio = files.some(f => f && f.type === 'audio')
|
||||
if (hasAudio) {
|
||||
return this.$lang('ai-chat.index.placeholderWithAudio') || '给语音留言加个说明(可选)'
|
||||
}
|
||||
const hasMedia = (this.pendingImages && this.pendingImages.length) || files.length > 0
|
||||
if (hasMedia) {
|
||||
return this.$lang('ai-chat.index.placeholderWithMedia') || '添加文字说明(可选)'
|
||||
}
|
||||
return this.$lang('ai-chat.index.placeholderDefault') || '发消息或按住说话'
|
||||
}
|
||||
},
|
||||
// 新增:组件销毁时清除所有定时器
|
||||
|
||||
Reference in New Issue
Block a user