From d266b99e9e3ce541d9b4da5fc0e5411bd09a270a Mon Sep 17 00:00:00 2001 From: hhhero Date: Sat, 13 Jul 2024 08:50:30 +0800 Subject: [PATCH] =?UTF-8?q?[=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96]AI:=20?= =?UTF-8?q?=E5=9B=9E=E6=98=BE=E5=86=99=E4=BD=9C=E7=B1=BB=E5=9E=8B=E5=88=87?= =?UTF-8?q?=E6=8D=A2=E4=B9=8B=E5=89=8D=E7=9A=84=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/ai/writer/index/components/Left.vue | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/views/ai/writer/index/components/Left.vue b/src/views/ai/writer/index/components/Left.vue index 6598bcb1..e21f4e90 100644 --- a/src/views/ai/writer/index/components/Left.vue +++ b/src/views/ai/writer/index/components/Left.vue @@ -27,12 +27,12 @@
-
+
({ ...initData }) +/** 用来记录切换之前所填写的数据,切换的时候给赋值回来 **/ +const recordFormData = {} as Record + /** 切换tab **/ const switchTab = (value: TabType) => { - selectedTab.value = value - formData.value = { ...initData } + if (value !== selectedTab.value) { + // 保存之前的久数据 + recordFormData[selectedTab.value] = formData.value + selectedTab.value = value + // 将之前的旧数据赋值回来 + formData.value = { ...initData, ...recordFormData[value] } + } } /** 提交写作 */