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
<Item v-for="(item, index) of items":item="item":key="item.id"/>
35
-
</VirtualList>
41
+
</virtualList>
36
42
</div>
37
43
</template>
38
44
39
45
<script>
40
46
importItemfrom'../item.vue';
41
-
importVirtualListfrom'vue-virtual-scroll-list';
47
+
importvirtualListfrom'vue-virtual-scroll-list';
42
48
43
49
exportdefault {
44
50
name:'demo',
45
-
46
-
components: { Item, VirtualList },
47
-
48
51
data () {
49
52
return {
50
53
items: [...]
51
54
}
52
-
}
55
+
},
56
+
components: { Item, virtualList }
53
57
}
54
58
</script>
55
59
```
56
60
57
-
The `<Item />` component is defined outside but included inside the `<VirtualList />` component. `VirtualList` has nothing to do with `<Item />`, so you can use virtuallist 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.
58
62
59
63
#### Using by script tag:
60
64
@@ -73,26 +77,26 @@ The `<Item />` component is defined outside but included inside the `<VirtualLis
73
77
newVue({
74
78
el:'#app',
75
79
data: {
76
-
items:newArray(10000)
80
+
items:newArray(100000)
77
81
},
78
82
components: {
79
83
'virtual-list': VirutalList
80
84
}
81
85
});
82
86
```
83
87
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.**
85
89
86
90
87
91
## Support props type
88
92
89
93
*Prop* | *Type* | *Required* | *Description* |
90
94
:--- | :--- | :--- | :--- |
91
95
| size | Number | ✓ | Each list item height, currently only supports fixed height. |
92
-
| remain | Number | ✓ | How many items except show in virtuallist viewport, so `size` and `remian` will determine the virtuallist outside container height (size × remian). |
93
-
| onScroll | Function | * | Call on virtuallist scroll event hanlding, param: `(scrollTop, e)`|
94
-
| toTop | Event | * | An event emit by virtuallist component when the list is scrolled on top. |
95
-
| toBottom | Event | * | An event emit by virtuallist 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. |
0 commit comments