Skip to content

Commit

Permalink
feat: update post slider
Browse files Browse the repository at this point in the history
  • Loading branch information
yanglbme committed Dec 19, 2024
1 parent 828b92a commit 8cc1f48
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/assets/less/app.less
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,12 @@ section {
position: relative;
margin: 0 -20px;
width: 375px;
min-height: 100vh;
padding: 20px;
font-size: 14px;
box-sizing: border-box;
outline: none;
word-wrap: break-word;
}

.preview table {
Expand Down
6 changes: 3 additions & 3 deletions src/components/CodemirrorEditor/PostSlider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function renamePost() {
}
store.renamePost(editTarget.value, renamePostInputVal.value)
isOpenEditDialog.value = false
toast.success(`文章更名成功`)
toast.success(`文章重命名成功`)
}
const isOpenDelPostConfirmDialog = ref(false)
Expand Down Expand Up @@ -105,9 +105,9 @@ function delPost() {
<DropdownMenuContent>
<DropdownMenuItem @click.stop="startRenamePost(index)">
<Edit3 class="mr-2 size-4" />
更名
重命名
</DropdownMenuItem>
<DropdownMenuItem @click.stop="startDelPost(index)">
<DropdownMenuItem v-if="store.posts.length > 1" @click.stop="startDelPost(index)">
<Trash class="mr-2 size-4" />
删除
</DropdownMenuItem>
Expand Down
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 = 0
currentPostIndex.value = posts.value.length - 1
}

watch(currentPostIndex, () => {
Expand Down

0 comments on commit 8cc1f48

Please sign in to comment.