Commit bebf1e7a by cherishsince

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

parent 03c6a6ce
...@@ -122,7 +122,12 @@ const props = defineProps({ ...@@ -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 () => { ...@@ -256,6 +261,8 @@ const createConversation = async () => {
await getChatConversationList() await getChatConversationList()
// 3、选中对话 // 3、选中对话
await handleConversationClick(conversationId) await handleConversationClick(conversationId)
// 4、回调
emits('onConversationCreate')
} }
/** /**
......
...@@ -3,6 +3,7 @@ ...@@ -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"
...@@ -441,6 +442,14 @@ const handlerTitleSuccess = async () => { ...@@ -441,6 +442,14 @@ const handlerTitleSuccess = async () => {
} }
/** /**
* 对话 - 创建
*/
const handleConversationCreate = async () => {
// 创建新的对话,清空输入框
prompt.value = ''
}
/**
* 对话 - 点击 * 对话 - 点击
*/ */
const handleConversationClick = async (conversation: ChatConversationVO) => { const handleConversationClick = async (conversation: ChatConversationVO) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment