File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,6 +86,63 @@ function App() {
8686}
8787```
8888
89+ ### Preact
90+
91+ ``` tsx
92+ import { VirtualList } from " @scrolloop/preact" ;
93+
94+ export function App() {
95+ const items = Array .from ({ length: 1000 }, (_ , i ) => ` Item #${i } ` );
96+
97+ return (
98+ <VirtualList
99+ count = { items .length }
100+ itemSize = { 50 }
101+ height = { 400 }
102+ renderItem = { (index , style ) => <div style = { style } >{ items [index ]} </div >}
103+ />
104+ );
105+ }
106+ ```
107+
108+ ### Vue
109+
110+ ``` vue
111+ <script setup lang="ts">
112+ import { VirtualList } from "@scrolloop/vue";
113+
114+ const items = Array.from({ length: 1000 }, (_, i) => `Item #${i}`);
115+ </script>
116+
117+ <template>
118+ <VirtualList :count="items.length" :item-size="50" :height="400">
119+ <template #default="{ index, style }">
120+ <div :style="style">{{ items[index] }}</div>
121+ </template>
122+ </VirtualList>
123+ </template>
124+ ```
125+
126+ ### Svelte
127+
128+ ``` svelte
129+ <script lang="ts">
130+ import { VirtualList } from "@scrolloop/svelte";
131+
132+ const items = Array.from({ length: 1000 }, (_, i) => `Item #${i}`);
133+ </script>
134+
135+ <VirtualList count={items.length} itemSize={50} height={400}>
136+ {#snippet children(index, style)}
137+ <div
138+ style={`position: ${style.position}; top: ${style.top}; left: ${style.left}; right: ${style.right}; height: ${style.height};`}
139+ >
140+ {items[index]}
141+ </div>
142+ {/snippet}
143+ </VirtualList>
144+ ```
145+
89146### React Native
90147
91148``` tsx
@@ -99,6 +156,7 @@ function App() {
99156 <VirtualList
100157 count = { items .length }
101158 itemSize = { 50 }
159+ height = { 400 }
102160 renderItem = { (index , style ) => (
103161 <View key = { index } style = { style } >
104162 <Text >{ items [index ]} </Text >
You can’t perform that action at this time.
0 commit comments