Feature(custom): show selected image number in gallery page

This commit is contained in:
Kuingsmile
2026-01-16 14:59:53 +08:00
parent 085a12d890
commit af0bb048d9

View File

@@ -9,7 +9,8 @@
</div>
<div>
<h1>{{ t('pages.gallery.title') }}</h1>
<p>{{ filterList.length }} {{ t('pages.gallery.images') }}</p>
<p v-if="selectedCount > 0">{{ `${selectedCount}/${filterList.length} ${t('pages.gallery.selected')}` }}</p>
<p v-else>{{ `${filterList.length} ${t('pages.gallery.images')}` }}</p>
</div>
</div>
<div class="header-actions">
@@ -178,7 +179,7 @@
</button>
<button class="action-btn delete-btn" :class="{ active: isMultiple(choosedList) }" @click="multiRemove">
<TrashIcon :size="16" />
{{ t('pages.gallery.delete') }}
{{ `${t('pages.gallery.delete')}${selectedCount > 0 ? ` (${selectedCount})` : ''}` }}
</button>
<button class="action-btn select-btn" :class="{ active: filterList.length > 0 }" @click="toggleSelectAll">
<CheckSquareIcon :size="16" />
@@ -693,6 +694,10 @@ const isAllSelected = computed(() => {
return Object.values(choosedList).length > 0 && filterList.value.every(item => choosedList[item.id!])
})
const selectedCount = computed(() => {
return Object.values(choosedList).filter(v => v).length
})
const currentPreviewImage = computed(() => {
const item = filterList.value[gallerySliderControl.index]
if (!item) return null