Skip to content

Commit a8163fc

Browse files
committed
Update readme.
1 parent 4a8a3c5 commit a8163fc

File tree

1 file changed

+18
-14
lines changed

1 file changed

+18
-14
lines changed

README.md

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
<a href="https://npmjs.com/package/vue-virtual-scroll-list">
22
<img src="https://img.shields.io/npm/v/vue-virtual-scroll-list.svg?style=flat" alt="NPM version"/>
33
</a>
4+
<a href="https://vuejs.org/">
5+
<img src="https://img.shields.io/badge/vue-2.x-brightgreen.svg" alt="Vue version"/>
6+
</a>
7+
<a href="https://github.com/tangbc/vue-virtual-scroll-list/blob/master/LICENSE">
8+
<img src="https://img.shields.io/github/license/tangbc/vue-virtual-scroll-list.svg" alt="MIT License"/>
9+
</a>
410

511
## vue-virtual-scroll-list
612

@@ -30,31 +36,29 @@ npm install vue-virtual-scroll-list --save
3036
```javascript
3137
<template>
3238
<div>
33-
<VirtualList :size="40" :remain="8">
39+
<virtualList :size="40" :remain="8">
3440
<Item v-for="(item, index) of items" :item="item" :key="item.id" />
35-
</VirtualList>
41+
</virtualList>
3642
</div>
3743
</template>
3844

3945
<script>
4046
import Item from '../item.vue';
41-
import VirtualList from 'vue-virtual-scroll-list';
47+
import virtualList from 'vue-virtual-scroll-list';
4248

4349
export default {
4450
name: 'demo',
45-
46-
components: { Item, VirtualList },
47-
4851
data () {
4952
return {
5053
items: [...]
5154
}
52-
}
55+
},
56+
components: { Item, virtualList }
5357
}
5458
</script>
5559
```
5660

57-
The `<Item />` component is defined outside but included inside the `<VirtualList />` component. `VirtualList` has nothing to do with `<Item />`, so you can use virtual list with any list item component your project need, you just want to care about component `<Item />` and data `items`.
61+
The `<Item>` component is included inside but defined outside the `<virtualList>` component. We see that `<virtualList>` **not** rely on `<Item>` component. So you can use virtual-list with any list item component freely.
5862

5963
#### Using by script tag:
6064

@@ -73,26 +77,26 @@ The `<Item />` component is defined outside but included inside the `<VirtualLis
7377
new Vue({
7478
el: '#app',
7579
data: {
76-
items: new Array(10000)
80+
items: new Array(100000)
7781
},
7882
components: {
7983
'virtual-list': VirutalList
8084
}
8185
});
8286
```
8387

84-
**Notice: list Item component or frag using `v-for` must designate the `:key` property.**
88+
**Notice: list Item component or DOM frag using `v-for` must designate the `:key` property.**
8589

8690

8791
## Support props type
8892

8993
*Prop* | *Type* | *Required* | *Description* |
9094
:--- | :--- | :--- | :--- |
9195
| size | Number || Each list item height, currently only supports fixed height. |
92-
| remain | Number || How many items except show in virtual list viewport, so `size` and `remian` will determine the virtual list outside container height (size × remian). |
93-
| onScroll | Function | * | Call on virtual list scroll event hanlding, param: `(scrollTop, e)` |
94-
| toTop | Event | * | An event emit by virtual list component when the list is scrolled on top. |
95-
| toBottom | Event | * | An event emit by virtual list component when the list is scrolled on bottom. |
96+
| remain | Number || How many items except show in virtual-list viewport, so `size` and `remian` will determine the virtual-list outside container height (size × remian). |
97+
| onScroll | Function | * | Call on virtual-list scroll event hanlding, param: `(scrollTop, e)` |
98+
| toTop | Event | * | An event emit by virtual-list component when the list is scrolled on top. |
99+
| toBottom | Event | * | An event emit by virtual-list component when the list is scrolled on bottom. |
96100

97101

98102
## Contributions

0 commit comments

Comments
 (0)