vvlv
vvlv component build with vue and rxjs
Selling Point
virtualList won't create or remove any DOM when you scroll the list, it will reuse the existing DOM and only change their position and data. But when you resize your window, you'll find the DOM's number is changed, so your virtual list will always have just right number of DOM.
Install
npm install --save vvlv
Usage
;@ data:Array<any> = ; { ; } { return <div class="virtual-box"> <virtual-list style="height: 100%;" list=thisdata options= height: 180 ... scopedSlots: { return <div class="card" style="height: 180px;"> <a href=itemurl> <div class="thumbnail"> <img src=itemthumbnailUrl alt=itemtitle/> </div> <div class="content"> <p>itemtitle</p> <p>Noitemid</p> </div> </a> </div> } > </virtual-list> </div> }
Props
Property | Type | Description |
---|---|---|
list |
Array<any> |
Data source of the list. |
options |
IVirtualListOptions |
Options of the virtual list. |
style |
any |
Style of VirtualList container. |
IVirtualListOptions
Property | Type | Default | Description |
---|---|---|---|
height |
number |
NOT NULL | Item height, it's necessary, use this property to calculate how many rows should be rendered actually. |
spare |
number |
3 | Spare rows out of the view. |
resize |
boolean |
true | To mark if the real dom number should be recomputed when the window resize. |
License
MIT © shaoxiong789