From 345a9b6600680d8048e733e61988b75b4e6c1ffe Mon Sep 17 00:00:00 2001 From: pipipi-pikachu Date: Sat, 27 Feb 2021 00:48:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=B9=BB=E7=81=AF=E7=89=87=E5=86=8D=E6=92=A4=E9=94=80=E5=90=8E?= =?UTF-8?q?=E7=B4=A2=E5=BC=95=E5=BC=82=E5=B8=B8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/actions.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/store/actions.ts b/src/store/actions.ts index 31ccc9a3..c4a235cb 100644 --- a/src/store/actions.ts +++ b/src/store/actions.ts @@ -61,8 +61,10 @@ export const actions: ActionTree = { const snapshot = snapshots[snapshotCursor] const { index, slides } = snapshot + const slideIndex = index > slides.length - 1 ? slides.length - 1 : index + commit(MutationTypes.SET_SLIDES, slides) - commit(MutationTypes.UPDATE_SLIDE_INDEX, index) + commit(MutationTypes.UPDATE_SLIDE_INDEX, slideIndex) commit(MutationTypes.SET_SNAPSHOT_CURSOR, snapshotCursor) commit(MutationTypes.SET_ACTIVE_ELEMENT_ID_LIST, []) }, @@ -75,8 +77,10 @@ export const actions: ActionTree = { const snapshot = snapshots[snapshotCursor] const { index, slides } = snapshot + const slideIndex = index > slides.length - 1 ? slides.length - 1 : index + commit(MutationTypes.SET_SLIDES, slides) - commit(MutationTypes.UPDATE_SLIDE_INDEX, index) + commit(MutationTypes.UPDATE_SLIDE_INDEX, slideIndex) commit(MutationTypes.SET_SNAPSHOT_CURSOR, snapshotCursor) commit(MutationTypes.SET_ACTIVE_ELEMENT_ID_LIST, []) },