Skip to content

Commit f8da8d6

Browse files
committed
Version 1.3.1
1 parent 39f86ff commit f8da8d6

File tree

2 files changed

+19
-23
lines changed

2 files changed

+19
-23
lines changed

README.md

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* [Props type](#props-type)
2626
* [Public methods](#public-methods)
2727
* [Special scenes](#special-scenes)
28-
* [About variable height](#about-variable-height)
28+
* [About variable mode](#about-variable-mode)
2929
* [About item mode](#about-item-mode)
3030
* [Contributions](#contributions)
3131
* [Changelogs](#changelogs)
@@ -142,28 +142,28 @@ new Vue({
142142
| totop | Function | * | Called when virtual-list is scrolled to top, no param. |
143143
| tobottom | Function | * | Called when virtual-list is scrolled to bottom, no param. |
144144
| onscroll | Function | * | Called when virtual-list is scrolling, with param: [`(event, data)`](https://github.com/tangbc/vue-virtual-scroll-list/releases/tag/v1.1.7). |
145-
| variable | Function or Boolean | * | For using virtual-list with `variable height mode`. If assign `Function`, this prop is a variable height getter function which is called with param: `(index)` when each item is ready to be calculated. If assign `Boolean`, virtual-list will get each item variable height by it's inline style height automatic. |
146-
| item | Component | * | For using virtual-list with `item mode` see [details](#about-item-mode) below. |
147-
| itemdata | Array | * | For using virtual-list with `item mode` see [details](#about-item-mode) below |
148-
| itemprop | Function | * | For using virtual-list with `item mode` see [details](#about-item-mode) below. |
145+
| variable | Function or Boolean | * | For using virtual-list in `variable-mode`. If assign `Function`, this prop is a variable height getter function which is called with param: `(index)` when each item is ready to be calculated. If assign `Boolean`, virtual-list will get each item variable height by it's inline style height automatic. |
146+
| item | Component | * | For using virtual-list in `item-mode`. List item vue component, see [details](#about-item-mode) below. |
147+
| itemdata | Array | * | For using virtual-list in `item-mode`. Prop data list or item slots assign to each item, see [details](#about-item-mode) below. |
148+
| itemprop | Function | * | For using virtual-list in `item-mode`. Function call when each item is going to be rendered, see [details](#about-item-mode) below. |
149149

150150

151151
## Public methods
152152

153-
Here are some usefull public methods if you can call via [`ref`](https://vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements):
153+
Here are some usefull public methods you can call via [`ref`](https://vuejs.org/v2/guide/components-edge-cases.html#Accessing-Child-Component-Instances-amp-Child-Elements):
154154

155155
* `forceRender()`: force render virtual-list if you need or make it refresh.
156156

157-
* `updateVariable(index)`: update variable by index in variable height mode.
157+
* `updateVariable(index)`: update item height by index in variable height mode.
158158

159159

160160
## Special scenes
161161

162-
### About variable height
162+
### About variable mode
163163

164-
In variable height mode, prop `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's `updateVariable(index)` method to clear the offset cache, refer to [variable example](https://github.com/tangbc/vue-virtual-scroll-list/blob/master/examples/variable/variable.vue#L1) source for detail.
164+
In `variable-mode`, prop `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's `updateVariable(index)` method to clear the offset cache, refer to [variable example](https://github.com/tangbc/vue-virtual-scroll-list/blob/master/examples/variable/variable.vue#L1) source for detail.
165165

166-
If you are using `variable` assign by `Boolean`, **do not** set inline style height inside `<item/>` component, you **must** set inline style height on `<item/>` component outside directly, such as:
166+
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:
167167
```vue
168168
<template>
169169
<div>
@@ -176,15 +176,9 @@ If you are using `variable` assign by `Boolean`, **do not** set inline style hei
176176

177177
### About item mode
178178

179-
Use item mode can save a considerable amount of memory, stats can see [#87](https://github.com/tangbc/vue-virtual-scroll-list/pull/87).
179+
Use `item-mode` can save a considerable amount of memory, stats data check here: [#87](https://github.com/tangbc/vue-virtual-scroll-list/pull/87).
180180

181-
In this mode prop `item`, `itemdata` and `itemprop` is both required, you don't need put `<item/>` inside `virtual-list` just assign it as prop `item`:
182-
183-
* `item`: The list vue item component.
184-
185-
* `itemdata`: The prop data list assign to each item.
186-
187-
* `itemprop`: Call when each item is going to be rendered.
181+
In this mode, prop `item` `itemdata` `itemprop` are both required, and you don't have to put `<item/>` with a v-for frag inside `virtual-list`, just assign it as prop `item`:
188182

189183
```vue
190184
<template>
@@ -209,11 +203,13 @@ In this mode prop `item`, `itemdata` and `itemprop` is both required, you don't
209203
}
210204
},
211205
methods: {
206+
// index: item index
207+
// data: item data get from itemdata array
212208
itemprop (index, data) {
209+
const id = { data }
210+
const itemProps = getItemProp(id)
213211
return {
214-
props: {
215-
data
216-
}
212+
props: itemProps // <item/> will receive prop with itemProps
217213
}
218214
}
219215
},

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "vue-virtual-scroll-list",
3-
"version": "1.3.0",
4-
"description": "A vue (2.x) component that support big data list with high scroll performance.",
3+
"version": "1.3.1",
4+
"description": "A vue component support big data list with high scroll performance.",
55
"main": "index.js",
66
"files": [
77
"index.js"

0 commit comments

Comments
 (0)