优化历史记录逻辑

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])
snapshotLength--
}
if(snapshotLength >= 2) {
db.snapshots.update(allKeys[snapshotLength - 2] as number, { index: state.slideIndex })
}
await db.snapshots.bulkDelete(needDeleteKeys)

View File

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