Skip to content

Commit

Permalink
fix: build type check
Browse files Browse the repository at this point in the history
  • Loading branch information
JunaYa committed Dec 17, 2024
1 parent abf11c7 commit e68b781
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/pages/main/components/SnapVault.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ async function loadData() {
list.value = entries.filter(entry => entry.isFile && FileSizeFormatter.isPictureFile(entry.name)).map(entry => ({
id: entry.name,
image: `${val?.value}/images/${entry.name}`,
checked: false,
}))
}
Expand All @@ -48,11 +49,11 @@ async function handleDelete() {
deleteLoading.value = true
const newList = list.value.filter(item => !item.checked)
const confirmation = await confirm(
`是否确认删除 ${ list.value.length } 个文件?`,
`是否确认删除 ${ newList.length } 个文件?`,
{ title: '确认删除', kind: 'warning' },
)
if (confirmation) {
for (const item of list.value) {
for (const item of newList) {
await remove(item.image)
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/pages/main/components/SnapVaultItemList.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import { confirm } from '@tauri-apps/plugin-dialog'
import { remove } from '@tauri-apps/plugin-fs'
import { useElementHover } from '@vueuse/core'
import { ref } from 'vue'
import Button from '~/components/Button.vue'
import Checkbox from '~/components/Checkbox.vue'
Expand All @@ -13,13 +12,10 @@ defineProps<{
}>()
const emit = defineEmits<{
(e: 'change'): void
(e: 'change', val: boolean): void
(e: 'remove'): void
}>()
const snapHoverableElement = ref()
const isHovered = useElementHover(snapHoverableElement)
const deleteLoading = ref(false)
async function handleDelete(path: string) {
Expand All @@ -37,11 +33,11 @@ async function handleDelete(path: string) {
</script>

<template>
<div ref="snapHoverableElement" class="flex flex-row items-center justify-between gap-2 relative rounded-md bg-card p-2">
<div class="flex flex-row items-center justify-between gap-2 relative rounded-md bg-card p-2">
<div class="flex flex-row items-center justify-center w-8 h-8">
<Checkbox :checked="item.checked" @change="() => emit('change', !checked)" />
<Checkbox :checked="item.checked" @change="() => emit('change', !item.checked)" />
</div>
<PictureReview :image-path="item.image" width="100" height="60" />
<PictureReview :image-path="item.image" :width="100" :height="60" />
<FileInfo :path="item.image" class-name="ml-8 flex flex-1 flex-row items-center justify-between gap-2" />
<div class="flex flex-row items-center justify-center gap-2">
<Button class-name="btn-action-icon" anim @click="() => handleDelete(item.image)">
Expand Down

0 comments on commit e68b781

Please sign in to comment.