feat: 输入框清空的问题
This commit is contained in:
@@ -78,8 +78,6 @@ const sendMessage = () => {
|
|||||||
// 否则发送新消息
|
// 否则发送新消息
|
||||||
if (!inputMessage.value.trim()) return;
|
if (!inputMessage.value.trim()) return;
|
||||||
emit('send', inputMessage.value)
|
emit('send', inputMessage.value)
|
||||||
inputMessage.value = ''
|
|
||||||
emit('update:inputMessage', inputMessage.value)
|
|
||||||
|
|
||||||
// 发送后保持焦点(可选)
|
// 发送后保持焦点(可选)
|
||||||
if (props.holdKeyboard && textareaRef.value) {
|
if (props.holdKeyboard && textareaRef.value) {
|
||||||
|
|||||||
@@ -235,9 +235,6 @@
|
|||||||
if (!inputText.trim()) return;
|
if (!inputText.trim()) return;
|
||||||
handleNoHideKeyboard()
|
handleNoHideKeyboard()
|
||||||
sendMessage(inputText)
|
sendMessage(inputText)
|
||||||
if(!isSessionActive.value) {
|
|
||||||
inputMessage.value = ''
|
|
||||||
}
|
|
||||||
// 发送消息后保持键盘状态
|
// 发送消息后保持键盘状态
|
||||||
if (holdKeyboard.value && inputAreaRef.value) {
|
if (holdKeyboard.value && inputAreaRef.value) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -343,6 +340,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
chatMsgList.value.push(newMsg)
|
chatMsgList.value.push(newMsg)
|
||||||
|
inputMessage.value = '';
|
||||||
sendChat(message, isInstruct)
|
sendChat(message, isInstruct)
|
||||||
console.log("发送的新消息:",JSON.stringify(newMsg))
|
console.log("发送的新消息:",JSON.stringify(newMsg))
|
||||||
}
|
}
|
||||||
@@ -466,7 +464,7 @@
|
|||||||
console.log('请求完成');
|
console.log('请求完成');
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
isSessionActive.value = false; // 出错也允许再次发送
|
isSessionActive.value = false; // 出错也允许再次发送
|
||||||
console.log('error:', err)
|
console.log('error:', err);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 打字机函数
|
// 打字机函数
|
||||||
|
|||||||
Reference in New Issue
Block a user