Skip to content

Commit

Permalink
feat: set index after deleting post (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme authored Dec 20, 2024
1 parent cf1e761 commit 1d6ab54
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const useStore = defineStore(`store`, () => {

const delPost = (index: number) => {
posts.value.splice(index, 1)
currentPostIndex.value = posts.value.length - 1
currentPostIndex.value = Math.min(index, posts.value.length - 1)
}

watch(currentPostIndex, () => {
Expand Down

0 comments on commit 1d6ab54

Please sign in to comment.