Skip to content

Commit 107724a

Browse files
committed
refactor(desk): improve v-gallery pagination
1 parent 45a6124 commit 107724a

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

packages/desktop/components/v-card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const colors = computed(() => {
4545
4646
// classes
4747
const classes = computed(() => {
48-
const result: string[] = []
48+
const result: string[] = ['transition-all']
4949
5050
if (props.color) {
5151
result.push(colors.value[props.color] || props.color)

packages/desktop/components/v-gallery.vue

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,9 @@ const size = computed(() => {
8989
9090
// pagination
9191
92-
const pagination = ref({ limit: +props.limit })
92+
const pagination = ref({ page: 1 })
9393
94-
const visibleItems = computed(() => props.items.slice(0, pagination.value.limit))
94+
const visibleItems = computed(() => props.items.slice(0, pagination.value.page * +props.limit))
9595
</script>
9696

9797
<template>
@@ -147,15 +147,14 @@ const visibleItems = computed(() => props.items.slice(0, pagination.value.limit)
147147
/>
148148

149149
<v-card
150-
v-if="items.length > pagination.limit"
150+
v-if="visibleItems.length < items.length"
151151
width="100%"
152-
class="cursor-pointer"
152+
class="cursor-pointer hover:bg-b-secondary"
153153
v-bind="bindings.card"
154-
:color="color"
155-
@click="pagination.limit = pagination.limit + Number(limit)"
154+
@click="pagination.page++"
156155
>
157-
<v-card-content class="items-center text-sm">
158-
<fa-icon icon="arrow-down" class="mr-4" />
156+
<v-card-content class="items-center justify-center text-sm text-t-secondary">
157+
<v-icon name="arrow-down" class="mr-4" />
159158

160159
<span>{{ `${$t('loadMore')} (${visibleItems.length}/${items.length})` }}</span>
161160
</v-card-content>

packages/examples/watch-list/medias/.is/views.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"component": "group",
4444
"id": "default",
4545
"label": "",
46+
"selected": "6ab296a7-aa37-4d21-b9cc-c077150c8345",
4647
"viewIds": [
4748
"77e4ca35-a424-4a98-aa0c-5e2c40b018ef",
4849
"6ab296a7-aa37-4d21-b9cc-c077150c8345",
@@ -134,7 +135,7 @@
134135
"height": "260"
135136
}
136137
},
137-
"limit": 100
138+
"limit": 20
138139
},
139140
{
140141
"component": "gallery",
@@ -195,7 +196,8 @@
195196
"width": "200",
196197
"height": "260"
197198
}
198-
}
199+
},
200+
"limit": 6
199201
},
200202
{
201203
"component": "gallery",

0 commit comments

Comments
 (0)