Skip to content

Commit

Permalink
feat: support empty view
Browse files Browse the repository at this point in the history
  • Loading branch information
JunaYa committed Dec 20, 2024
1 parent 9676b89 commit 0a1d411
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
Binary file added src/assets/images/empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/pages/main/components/Empty.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script setup lang="ts">
import empty from '~/assets/images/empty.png'
</script>

<template>
<div class="m-auto h-full w-full flex flex-col items-center justify-center">
<img :src="empty" alt="empty" class="h-[430px] w-[340px]">
</div>
</template>
15 changes: 10 additions & 5 deletions src/pages/main/components/SnapVault.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import { computed, onMounted, ref, watch } from 'vue'
import { FileSizeFormatter } from '~/utils/file'
import Checkbox from '~/components/Checkbox.vue'
import SnapVaultItem from './SnapVaultItem.vue'
import Empty from './Empty.vue'
import SnapVaultItemList from './SnapVaultItemList.vue'
const store = new LazyStore('settings.json')
const list = ref<{ id: string, image: string, checked: boolean, datetime: Date }[]>([])
Expand Down Expand Up @@ -113,11 +115,14 @@ onMounted(async () => {
</i>
</div>
</div>
<div v-if="displayMode === 'list'" class="grid grid-cols-1 gap-4">
<SnapVaultItemList v-for="(item, index) in list" :key="item.id" :item="item" @remove="loadData" @change="(val: boolean) => onChange(index, val)" />
</div>
<div v-else class="grid grid-cols-3 gap-4">
<SnapVaultItem v-for="item in list" :key="item.id" :item="item" @change="loadData" />
<div v-if="list.length > 0" class="flex flex-row items-center justify-center">
<div v-if="displayMode === 'list'" class="grid grid-cols-1 gap-4">
<SnapVaultItemList v-for="(item, index) in list" :key="item.id" :item="item" @remove="loadData" @change="(val: boolean) => onChange(index, val)" />
</div>
<div v-else class="grid grid-cols-3 gap-4">
<SnapVaultItem v-for="item in list" :key="item.id" :item="item" @change="loadData" />
</div>
</div>
<Empty v-else />
</div>
</template>

0 comments on commit 0a1d411

Please sign in to comment.