From c45af1e864416c69ec27f845198971038179c2af Mon Sep 17 00:00:00 2001 From: wanglin2 <1013335014@qq.com> Date: Wed, 2 Aug 2023 09:19:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=88=9B=E5=BB=BA=E7=9A=84=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=88=A0=E9=99=A4=E4=BA=94=E7=A7=92=E6=9C=AA=E6=93=8D?= =?UTF-8?q?=E4=BD=9C=E8=BF=9B=E8=A1=8C=E4=BF=9D=E5=AD=98=E7=9A=84=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/pages/Edit/components/Edit.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/src/pages/Edit/components/Edit.vue b/web/src/pages/Edit/components/Edit.vue index 0e1e4c9f..18058b11 100644 --- a/web/src/pages/Edit/components/Edit.vue +++ b/web/src/pages/Edit/components/Edit.vue @@ -120,7 +120,8 @@ export default { prevImg: '', openTest: false, isFirst: true, - autoSaveTimer: null + autoSaveTimer: null, + isNewFile: false } }, computed: { @@ -269,6 +270,7 @@ export default { this.setFileName(data.name) storeData = data.content } else { + this.isNewFile = true this.setFileName('未命名') storeData = getData() } @@ -307,6 +309,7 @@ export default { autoSave() { clearTimeout(this.autoSaveTimer) this.autoSaveTimer = setTimeout(() => { + if (this.isNewFile) return this.saveToLocal() }, 5000) }, @@ -505,9 +508,9 @@ export default { async saveToLocal() { let id = this.$route.params.id let data = this.mindMap.getData(true) - console.log('保存', id, data) let res = await window.electronAPI.save(id, JSON.stringify(data), this.fileName) if (res) { + this.isNewFile = false this.setFileName(res) } this.setIsUnSave(false)