From 404dfd588ca780dbafea362880d185d3643ebf8b Mon Sep 17 00:00:00 2001 From: wujingjing <gersonwu@qq.com> Date: 星期四, 31 十月 2024 13:45:55 +0800 Subject: [PATCH] createTime --- src/components/chat/hooks/useAssistantContentOpt.ts | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/components/chat/hooks/useAssistantContentOpt.ts b/src/components/chat/hooks/useAssistantContentOpt.ts index 4cba696..843bc1c 100644 --- a/src/components/chat/hooks/useAssistantContentOpt.ts +++ b/src/components/chat/hooks/useAssistantContentOpt.ts @@ -6,15 +6,15 @@ 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>; sendChatMessage: any; displayMessageList: ComputedRef<ChatMessage[]>; }; export const useAssistantContentOpt = (option: AssistantContentOptOption) => { - const { forbidScroll, sendChatMessage, displayMessageList } = option; + const { sendChatMessage, displayMessageList } = option; const { toClipboard } = useClipboard(); const preQuestion = ref(null); @@ -37,10 +37,7 @@ answer_state: toSetState, }); item.state = toSetState; - forbidScroll.value = true; - nextTick(() => { - forbidScroll.value = false; - }); + }; const unLikeClick = async (item) => { @@ -51,10 +48,7 @@ }); item.state = toSetState; - forbidScroll.value = true; - nextTick(() => { - forbidScroll.value = false; - }); + }; const feedbackPosition = ref({ x: 0, @@ -79,14 +73,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 +105,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