优化历史记录逻辑

This commit is contained in:
pipipi-pikachu 2021-01-19 21:21:04 +08:00
parent beee25590d
commit a22463fa9c
2 changed files with 15 additions and 13 deletions

View File

@ -43,6 +43,9 @@ export const actions: ActionTree<State, State> = {
needDeleteKeys.push(allKeys[0]) needDeleteKeys.push(allKeys[0])
snapshotLength-- snapshotLength--
} }
if(snapshotLength >= 2) {
db.snapshots.update(allKeys[snapshotLength - 2] as number, { index: state.slideIndex })
}
await db.snapshots.bulkDelete(needDeleteKeys) await db.snapshots.bulkDelete(needDeleteKeys)

View File

@ -10,9 +10,9 @@
'slide-item', 'slide-item',
`turning-mode-${slide.turningMode || 'slideY'}`, `turning-mode-${slide.turningMode || 'slideY'}`,
{ {
'show': index === slideIndex, 'current': index === slideIndex,
'prev': index < slideIndex, 'before': index < slideIndex,
'next': index > slideIndex, 'after': index > slideIndex,
} }
]" ]"
v-for="(slide, index) in slides" v-for="(slide, index) in slides"
@ -260,45 +260,44 @@ export default defineComponent({
width: 100%; width: 100%;
height: 100%; height: 100%;
&.show { &.current {
z-index: 2; z-index: 2;
} }
&.turning-mode-no { &.turning-mode-no {
&.prev { &.before {
transform: translateY(-100%); transform: translateY(-100%);
} }
&.next { &.after {
transform: translateY(100%); transform: translateY(100%);
} }
} }
&.turning-mode-fade { &.turning-mode-fade {
transition: opacity .75s; transition: opacity .75s;
&.before {
&.prev {
pointer-events: none; pointer-events: none;
opacity: 0; opacity: 0;
} }
&.next { &.after {
pointer-events: none; pointer-events: none;
opacity: 0; opacity: 0;
} }
} }
&.turning-mode-slideX { &.turning-mode-slideX {
transition: transform .35s; transition: transform .35s;
&.prev { &.before {
transform: translateX(-100%); transform: translateX(-100%);
} }
&.next { &.after {
transform: translateX(100%); transform: translateX(100%);
} }
} }
&.turning-mode-slideY { &.turning-mode-slideY {
transition: transform .35s; transition: transform .35s;
&.prev { &.before {
transform: translateY(-100%); transform: translateY(-100%);
} }
&.next { &.after {
transform: translateY(100%); transform: translateY(100%);
} }
} }