From 35fab4e99c4167324d6eebb8ba6e4bbbed12adbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E5=98=89=E8=80=80?= Date: Fri, 18 Jun 2021 10:46:43 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E6=92=A4?= =?UTF-8?q?=E5=9B=9E=E6=93=8D=E4=BD=9C=E4=BC=9A=E6=92=A4=E5=9B=9E=E5=88=B0?= =?UTF-8?q?=E5=85=B6=E4=BB=96=E4=BD=9C=E5=93=81=E6=95=B0=E6=8D=AE=E7=9A=84?= =?UTF-8?q?=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/pages/editor/Index.vue | 2 ++ client/store/modules/editor.js | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/client/pages/editor/Index.vue b/client/pages/editor/Index.vue index baee5fb..f1980b0 100644 --- a/client/pages/editor/Index.vue +++ b/client/pages/editor/Index.vue @@ -149,6 +149,8 @@ this.$store.dispatch('setPrjectData', { ...res.body }) + this.$store.dispatch('clearHistoryCache') + this.$store.dispatch('addHistoryCache') }).catch(() => { this.loading = false; }) diff --git a/client/store/modules/editor.js b/client/store/modules/editor.js index 2bb9dfc..2c64c02 100644 --- a/client/store/modules/editor.js +++ b/client/store/modules/editor.js @@ -260,6 +260,9 @@ const actions = { addHistoryCache({commit}){ commit('addHistoryCache') }, + clearHistoryCache({commit}) { + commit('clearHistoryCache') + }, editorUndo({commit, state}){ if(!getters.canUndo(state)){ return; @@ -442,6 +445,11 @@ const mutations = { state.historyCache.splice(100) state.currentHistoryIndex++ }, + + clearHistoryCache(state) { + state.historyCache = [] + state.currentHistoryIndex = -1 + }, /** * * @param state