From 517c7dd458e14ce18e6b81b61815fe9cbca1034f Mon Sep 17 00:00:00 2001 From: zhuzhutx <867963316@qq.com> Date: Sun, 14 Aug 2022 16:58:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dredo=E7=9A=84Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/DrawingBroad.vue | 3 +-- src/store/index.ts | 7 +++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/components/DrawingBroad.vue b/src/components/DrawingBroad.vue index 4d77cbf..dc54adf 100644 --- a/src/components/DrawingBroad.vue +++ b/src/components/DrawingBroad.vue @@ -15,9 +15,8 @@ const containerStyle = computed(() => ({ })) function saveStateList() { - if (statePoint.value !== stateStack.value.length - 1) { + if (statePoint.value !== stateStack.value.length - 1||statePoint.value === -1) { mainStore.clearStackTop(); - console.log(stateStack.value.concat()) } stateStack.value.push(tList.value.concat()) statePoint.value = stateStack.value.length - 1 diff --git a/src/store/index.ts b/src/store/index.ts index 905bea8..8582526 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -11,7 +11,7 @@ interface componentType { } // 使用setup模式定义 -// Re: 不建议使用setup模式定义,已改进 +// Re: 不建议使用setup模式定义,已改进 git export const userMainStore = defineStore('mainStore', { state: () => ({ list: config.componentList, @@ -22,8 +22,11 @@ export const userMainStore = defineStore('mainStore', { }), actions: { executeUndo(): void { - if (this.statePoint < 0) return; this.statePoint--; + if (this.statePoint < 0) { + this.tList = [] + return + } this.tList = this.stateStack[this.statePoint].concat(); }, executeRedo(): void { -- Gitee