You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Event scroll, reach top and bottom can be detected.
53
-
54
52
55
53
## Live demos
56
54
57
-
*[Build 100,000 items with item-mode](https://tangbc.github.io/vue-virtual-scroll-list/demos/item-mode).
58
-
59
55
*[Build 100,000 items with vfor-mode](https://tangbc.github.io/vue-virtual-scroll-list/demos/vfor-mode).
60
56
57
+
*[Build 100,000 items with item-mode](https://tangbc.github.io/vue-virtual-scroll-list/demos/item-mode).
58
+
61
59
*[Build 100,000 items with variable height](https://tangbc.github.io/vue-virtual-scroll-list/demos/variable-height).
62
60
63
61
The main difference between `item-mode` and `vfor-mode` is that: `item-mode` make a higher performance but not very convenient to handle changing data frequently; however, `vfor-mode` is just the opposite.
@@ -96,6 +94,10 @@ According to the demos above, here are lists of approximate statistics:
This mode can save a considerable amount of memory and performance. Props `item`, `itemcount` and `itemprops` are both required, you don't need put `<item/>` with a v-for directive inside `virtual-list`, just assign it as prop `item`:
Whenever you want to change any item data from list in this mode, you need call public method `forceRender()` after source data change. Increase or decrease items, you need to keep `itemcount` and call `forceRender()` together.
163
+
164
+
### variable height
165
+
166
+
Using variable height, props `remain` and `size` is still required. All the index variable height and scroll offset will be cached by virtual-list after the binary-search calculate, if you want to change anyone `<item/>` height from data, you need call public method `updateVariable(index)` to clear the offset cache.
167
+
168
+
If you assign `variable` as `true`, **do not** set inline style height inside `<item/>` component, you **must** set inline style height on `<item/>` component outside directly, such as:
**More use ways or getting start you can refer to these clearly [demos](https://github.com/tangbc/vue-virtual-scroll-list/tree/master/demos) or [test suites](https://github.com/tangbc/vue-virtual-scroll-list/tree/master/test).**
123
180
124
181
@@ -162,68 +219,6 @@ Here are some usefull public methods you can call via [`ref`](https://vuejs.org/
162
219
*`updateVariable(index)`: update item height by index in variable height list.
163
220
164
221
165
-
## Special scenes
166
-
167
-
### About variable height
168
-
169
-
In variable height, prop `remain` and `size` is still required. All the index variable height and scroll offset will be cached by virtual-list after the binary-search calculate, if you want to change anyone `<item/>` height from data, you should call virtual-list public method `updateVariable(index)` to clear the offset cache.
170
-
171
-
If you assign `variable` as `true`, **do not** set inline style height inside `<item/>` component, you **must** set inline style height on `<item/>` component outside directly, such as:
Corresponding example you can refer to the [demo of variable height](https://tangbc.github.io/vue-virtual-scroll-list/demos/variable-height).
183
-
184
-
### About item mode
185
-
186
-
Using `item-mode` can save a considerable amount of memory and performance. In this mode, prop `item`, `itemcount` and `itemprops` are both required, and you don't have to put `<item/>` with a v-for directive inside `virtual-list`, just assign it as prop `item`:
187
-
188
-
```vue
189
-
<template>
190
-
<div>
191
-
<virtual-list :size="40" :remain="8"
192
-
:item="item"
193
-
:itemcount="100000"
194
-
:itemprops="getItemprops"
195
-
/>
196
-
</div>
197
-
</template>
198
-
199
-
<script>
200
-
import itemComponent from '../item.vue'
201
-
import virtualList from 'vue-virtual-scroll-list'
202
-
export default {
203
-
data () {
204
-
return {
205
-
item: itemComponent,
206
-
}
207
-
},
208
-
methods: {
209
-
getItemprops (itemIndex) {
210
-
const itemProps = getItemProp(itemIndex)
211
-
return {
212
-
props: itemProps // <item/> will render with itemProps.
213
-
}
214
-
}
215
-
},
216
-
components: { 'virtual-list': virtualList }
217
-
}
218
-
</script>
219
-
220
-
```
221
-
222
-
Whenever if you want to change any item data from list in `item-mode`, you just need call public method `forceRender()` after source data change. Increase or decrease items, you need to change `itemcount` and call `forceRender()` together.
223
-
224
-
Corresponding example you can refer to the [demo of item-mode](https://tangbc.github.io/vue-virtual-scroll-list/demos/item-mode).
225
-
226
-
227
222
## Contributions
228
223
229
224
Welcome to improve vue-virtual-scroll-list with any issue, pull request or code review.
0 commit comments