feat: 输入框清空的问题

This commit is contained in:
zoujing
2025-08-06 14:16:31 +08:00
parent fe0a36e446
commit af9c3c7c28
2 changed files with 2 additions and 6 deletions

View File

@@ -78,8 +78,6 @@ const sendMessage = () => {
// 否则发送新消息
if (!inputMessage.value.trim()) return;
emit('send', inputMessage.value)
inputMessage.value = ''
emit('update:inputMessage', inputMessage.value)
// 发送后保持焦点(可选)
if (props.holdKeyboard && textareaRef.value) {

View File

@@ -235,9 +235,6 @@
if (!inputText.trim()) return;
handleNoHideKeyboard()
sendMessage(inputText)
if(!isSessionActive.value) {
inputMessage.value = ''
}
// 发送消息后保持键盘状态
if (holdKeyboard.value && inputAreaRef.value) {
setTimeout(() => {
@@ -343,6 +340,7 @@
}
}
chatMsgList.value.push(newMsg)
inputMessage.value = '';
sendChat(message, isInstruct)
console.log("发送的新消息:",JSON.stringify(newMsg))
}
@@ -466,7 +464,7 @@
console.log('请求完成');
}).catch(err => {
isSessionActive.value = false; // 出错也允许再次发送
console.log('error:', err)
console.log('error:', err);
});
// 打字机函数