Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ When the user scrolls inside RecycleScroller, the views are mostly just moved ar
- `visible`: emitted when the scroller considers itself to be visible in the page.
- `hidden`: emitted when the scroller is hidden in the page.
- `update (startIndex, endIndex, visibleStartIndex, visibleEndIndex)`: emitted each time the views are updated, only if `emitUpdate` prop is `true`
- `scroll-start`: emitted when the first item is rendered.
- `scroll-end`: emitted when the last item is rendered.

### Default scoped slot props

Expand Down
10 changes: 10 additions & 0 deletions docs-src/src/components/RecycleScrollerDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
@update="onUpdate"
@visible="onVisible"
@hidden="onHidden"
@scroll-start="onScrollStart"
@scroll-end="onScrollEnd"
>
<template v-slot="props">
<div
Expand Down Expand Up @@ -206,6 +208,14 @@ export default {
onHidden () {
console.log('hidden')
},

onScrollStart () {
console.log('scroll start')
},

onScrollEnd () {
console.log('scroll end')
},
},
}
</script>
Expand Down
3 changes: 3 additions & 0 deletions src/components/RecycleScroller.vue
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,9 @@ export default {

// No view assigned to item
if (!view) {
if (i === items.length - 1) this.$emit('scroll-end')
if (i === 0) this.$emit('scroll-start')

type = item[typeField]
unusedPool = unusedViews.get(type)

Expand Down