DynamicScroller
This works just like the RecycleScroller, but it can render items with unknown sizes!
Basic usage
vue
<script>
export default {
props: {
items: Array,
},
}
</script>
<template>
<DynamicScroller
:items="items"
:min-item-size="54"
class="scroller"
>
<template #default="{ item, index, active }">
<DynamicScrollerItem
:item="item"
:active="active"
:size-dependencies="[
item.message,
]"
:data-index="index"
>
<div class="avatar">
<img
:key="item.avatar"
:src="item.avatar"
alt="avatar"
class="image"
>
</div>
<div class="text">
{{ item.message }}
</div>
</DynamicScrollerItem>
</template>
</DynamicScroller>
</template>
<style scoped>
.scroller {
height: 100%;
}
</style>Important notes
minItemSizeis required for the initial render of items.DynamicScrollerwon't detect size changes on its own, but you can put values that can affect the item size withsize-dependencieson DynamicScrollerItem.- You don't need to have a
sizefield on the items.
Props
Extends all the RecycleScroller props.
TIP
It's not recommended to change the sizeField prop since all the size management is done internally.
Events
Extends all the RecycleScroller events.
Default scoped slot props
Extends all the RecycleScroller scoped slot props.
Other slots
Extends all the RecycleScroller other slots.