【解决todo】Chat 聊天,新建对话清空输入框

This commit is contained in:
cherishsince
2024-05-24 10:35:11 +08:00
parent 03c6a6ce59
commit bebf1e7ae3
2 changed files with 17 additions and 1 deletions

View File

@@ -122,7 +122,12 @@ const props = defineProps({
}) })
// 定义钩子 // 定义钩子
const emits = defineEmits(['onConversationClick', 'onConversationClear', 'onConversationDelete']) const emits = defineEmits([
'onConversationCreate',
'onConversationClick',
'onConversationClear',
'onConversationDelete'
])
/** /**
* 对话 - 搜索 * 对话 - 搜索
@@ -256,6 +261,8 @@ const createConversation = async () => {
await getChatConversationList() await getChatConversationList()
// 3、选中对话 // 3、选中对话
await handleConversationClick(conversationId) await handleConversationClick(conversationId)
// 4、回调
emits('onConversationCreate')
} }
/** /**

View File

@@ -3,6 +3,7 @@
<!-- 左侧会话列表 --> <!-- 左侧会话列表 -->
<Conversation :active-id="activeConversationId" <Conversation :active-id="activeConversationId"
ref="conversationRef" ref="conversationRef"
@onConversationCreate="handleConversationCreate"
@onConversationClick="handleConversationClick" @onConversationClick="handleConversationClick"
@onConversationClear="handlerConversationClear" @onConversationClear="handlerConversationClear"
@onConversationDelete="handlerConversationDelete" @onConversationDelete="handlerConversationDelete"
@@ -440,6 +441,14 @@ const handlerTitleSuccess = async () => {
await getConversation(activeConversationId.value) await getConversation(activeConversationId.value)
} }
/**
* 对话 - 创建
*/
const handleConversationCreate = async () => {
// 创建新的对话,清空输入框
prompt.value = ''
}
/** /**
* 对话 - 点击 * 对话 - 点击
*/ */