From 64c8ee1c96774f3f5f178d96e94f9915361a9179 Mon Sep 17 00:00:00 2001 From: DebugIsFalse <511418503@qq.com> Date: Mon, 27 May 2024 17:13:50 +0800 Subject: [PATCH] Update [id].vue --- pages/search/[id].vue | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pages/search/[id].vue b/pages/search/[id].vue index fac2621..23c2735 100644 --- a/pages/search/[id].vue +++ b/pages/search/[id].vue @@ -22,11 +22,11 @@ /> -
+

{{ askingData.question }}

{ - let { answer, actions } = item - const historyItem = { article: answer, desLoading: false, searchLoading: false, ansLoading: false } - // console.log(`actions:`, typeof actions) + let { answer, actions, question } = item + const historyItem = { article: answer, question, desLoading: false, searchLoading: false, ansLoading: false} // todo ?action为啥成了string? actions = typeof actions === 'string' ? JSON.parse(actions) : actions // console.log(actions) @@ -142,7 +141,9 @@ const handleCloseHistoryAsk = () => { }) } const createGenerateInitItem = (question) => { - data.value.push(askingData.value) + if (askingData.value.question) { + data.value.push(askingData.value) + } nextTick(() => { handleCloseHistoryAsk() askingData.value = { question, desLoading: true } @@ -151,8 +152,10 @@ const createGenerateInitItem = (question) => { const handleContinueAsk = (question) => { if (asking.value) return asking.value = true - askingRef.value.handleCollapse(true) createGenerateInitItem(question) + nextTick(() => { + askingRef.value && askingRef.value.handleCollapse(true) + }) generateFetchData(question) setTimeout(() => { scrollToView() @@ -282,7 +285,8 @@ onMounted( () => { if (data.value.length === 0 && state.query) { generateFetchData(state.query) } else { - + asking.value = false; + askingData.value = {} } }) -- GitLab