fix: Adjust mobile itemSize for virtual scrolling
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user