Skip to content

Commit 26d4820

Browse files
author
Guillaume Chau
committed
RecycleList docs
1 parent a51a1a9 commit 26d4820

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,47 @@ export default {
347347
</script>
348348
```
349349

350+
# Exprimental component: RecycleList
351+
352+
It's very similar to virtual-scroller, but:
353+
354+
- Faster and less CPU intensive
355+
- Different HTML structure (don't try doing a `<table>` with it, use divs!)
356+
- No tag customization
357+
- No renderers features (use scoped slots!)
358+
- Recycles scoped slot content (including components) in the list (no destroyed components), depending on item types (customize with `typeField` prop)
359+
- The components used in the list should expect `item` prop change without being re-created (use computed props or watchers to properly react to props changes!)
360+
- You don't need to set `key` on list content (but you should on `<img>` elements)
361+
362+
Both fixed and dynamic height modes are supported (set `itemHeight` prop for fixed height mode).
363+
364+
```html
365+
<recycle-list
366+
class="scroller"
367+
:items="items"
368+
>
369+
<!-- For each item -->
370+
<template slot-scope="{ item }">
371+
<!-- Reactive dynamic height -->
372+
<div
373+
v-if="item.type === 'letter'"
374+
class="letter big"
375+
@click="item.height = (item.height === 200 ? 300 : 200)"
376+
>
377+
{{ item.value }}
378+
</div>
379+
380+
<!-- Component -->
381+
<MyPersonComponent
382+
v-else-if="item.type === 'person'"
383+
:data="item.value"
384+
/>
385+
</template>
386+
</recycle-list>
387+
```
388+
389+
Please share feeback on the new RecycleList component in the issues!
390+
350391
---
351392

352393
## License

0 commit comments

Comments
 (0)