fix: Adjust mobile itemSize for virtual scrolling

This commit is contained in:
hayden
2024-11-02 20:07:58 +08:00
parent 274a598602
commit 599ac92a2b

View File

@@ -41,7 +41,7 @@
<ResponseScroll
:items="list"
:itemSize="cardWidth / aspect + gutter"
:itemSize="itemSize"
:row-key="(item) => item.map(genModelKey).join(',')"
class="h-full flex-1"
>
@@ -120,6 +120,17 @@ const sortOrderOptions = ref(
}),
)
const itemSize = computed(() => {
let itemWidth = cardWidth
let itemGutter = gutter
if (isMobile.value) {
const baseSize = 16
itemWidth = window.innerWidth - baseSize * 2 * 2
itemGutter = baseSize * 2
}
return itemWidth / aspect + itemGutter
})
const colSpan = ref(1)
const colSpanWidth = ref(cardWidth)