feat: update post slider

This commit is contained in:
yanglbme 2024-12-19 15:15:32 +08:00
parent 828b92ac21
commit 8cc1f48140
3 changed files with 6 additions and 4 deletions

View File

@ -77,10 +77,12 @@ section {
position: relative; position: relative;
margin: 0 -20px; margin: 0 -20px;
width: 375px; width: 375px;
min-height: 100vh;
padding: 20px; padding: 20px;
font-size: 14px; font-size: 14px;
box-sizing: border-box; box-sizing: border-box;
outline: none; outline: none;
word-wrap: break-word;
} }
.preview table { .preview table {

View File

@ -40,7 +40,7 @@ function renamePost() {
} }
store.renamePost(editTarget.value, renamePostInputVal.value) store.renamePost(editTarget.value, renamePostInputVal.value)
isOpenEditDialog.value = false isOpenEditDialog.value = false
toast.success(`文章名成功`) toast.success(`文章重命名成功`)
} }
const isOpenDelPostConfirmDialog = ref(false) const isOpenDelPostConfirmDialog = ref(false)
@ -105,9 +105,9 @@ function delPost() {
<DropdownMenuContent> <DropdownMenuContent>
<DropdownMenuItem @click.stop="startRenamePost(index)"> <DropdownMenuItem @click.stop="startRenamePost(index)">
<Edit3 class="mr-2 size-4" /> <Edit3 class="mr-2 size-4" />
重命
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem @click.stop="startDelPost(index)"> <DropdownMenuItem v-if="store.posts.length > 1" @click.stop="startDelPost(index)">
<Trash class="mr-2 size-4" /> <Trash class="mr-2 size-4" />
删除 删除
</DropdownMenuItem> </DropdownMenuItem>

View File

@ -73,7 +73,7 @@ export const useStore = defineStore(`store`, () => {
const delPost = (index: number) => { const delPost = (index: number) => {
posts.value.splice(index, 1) posts.value.splice(index, 1)
currentPostIndex.value = 0 currentPostIndex.value = posts.value.length - 1
} }
watch(currentPostIndex, () => { watch(currentPostIndex, () => {