From f7ea0b4ceb05fc15e363d918bff74022efd29d53 Mon Sep 17 00:00:00 2001
From: wujingjing <gersonwu@qq.com>
Date: 星期四, 22 八月 2024 17:36:31 +0800
Subject: [PATCH] onClickOutside

---
 src/components/chat/hooks/useAssistantContentOpt.ts |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/components/chat/hooks/useAssistantContentOpt.ts b/src/components/chat/hooks/useAssistantContentOpt.ts
index 4cba696..a691603 100644
--- a/src/components/chat/hooks/useAssistantContentOpt.ts
+++ b/src/components/chat/hooks/useAssistantContentOpt.ts
@@ -6,6 +6,7 @@
 import { AnswerState, AnswerType, RoleEnum } from '../model/types';
 import { SetHistoryAnswerState } from '/@/api/ai/chat';
 import { useClickOther } from '/@/hooks/useClickOther';
+import { onClickOutside } from '@vueuse/core';
 
 export type AssistantContentOptOption = {
 	forbidScroll: Ref<boolean>;
@@ -79,14 +80,22 @@
 			};
 		});
 	};
-	useClickOther(
-		computed(() => feedbackPanelRef.value[curFeedbackIndex.value]),
-		feedbackIsShow,
-		() => {
+
+	onClickOutside(
+		computed(() => feedbackPanelRef.value?.[curFeedbackIndex.value]),
+		(e) => {
 			feedbackIsShow.value = false;
 			feedbackContent.value = '';
 		}
 	);
+	// useClickOther(
+	// 	computed(() => feedbackPanelRef.value?.[curFeedbackIndex.value]),
+	// 	feedbackIsShow,
+	// 	() => {
+	// 		feedbackIsShow.value = false;
+	// 		feedbackContent.value = '';
+	// 	}
+	// );
 	const showAskMore = computed(() => {
 		if (!displayMessageList.value || displayMessageList.value.length === 0) return false;
 		const last = displayMessageList.value.at(-1);
@@ -103,7 +112,7 @@
 		sendChatMessage({ type: AnswerType.Text, values: item.question });
 	};
 
-	const fixQuestionClick = (item,originData) => {
+	const fixQuestionClick = (item, originData) => {
 		if (!item.question) return;
 		preQuestion.value = originData?.question;
 		try {

--
Gitblit v1.9.3