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] } + } } /** 提交写作 */