All Projects → yuanfux → virtual-block

yuanfux / virtual-block

Licence: other
🌈vue-virtual-block render what's visible

Programming Languages

Vue
7211 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to virtual-block

react-virtual-list
A tiny virtualization list component(gzipped 6KB), supports dynamic height: https://dwqs.github.io/react-virtual-list/
Stars: ✭ 45 (+0%)
Mutual labels:  virtual-list
react-smart-scroll
Efficient rendering of long lists in React
Stars: ✭ 27 (-40%)
Mutual labels:  virtualscroll
BlazorVirtualScrolling
Blazor components for efficiently rendering large lists and data using virtual scrolling
Stars: ✭ 56 (+24.44%)
Mutual labels:  virtualscroll
vue-auto-virtual-scroll-list
A vue (2.x) component for large lists with variable item height
Stars: ✭ 30 (-33.33%)
Mutual labels:  virtual-list
Fairygui Unity
A flexible UI framework for Unity
Stars: ✭ 2,007 (+4360%)
Mutual labels:  virtual-list
Vue Virtual Scroll List
⚡️A vue component support big amount data list with high render performance and efficient.
Stars: ✭ 3,201 (+7013.33%)
Mutual labels:  virtual-list

virtual-block

npm version

🌈Render what's visible

Demo

Install

npm i virtual-block

Import

import Vue from 'vue'
import VirtualBlock from 'virtual-block/dist'
Vue.use(VirtualBlock)

Usage

Page Mode

<VirtualBlock :data="blocks">
    <template slot-scope="{data}">
        <!-- self defined slots -->
    </template>
</VirtualBlock>

Container Mode

<VirtualBlock :height="300" :pageMode="false" :data="blocks">
    <template slot-scope="{data}">
        <!-- self defined slots -->
    </template>
</VirtualBlock>

Fixed Block Height

<VirtualBlock :height="300" :pageMode="false" :fixedBlockHeight="50" :data="blocks">
    <template slot-scope="{data}">
        <!-- self defined slots -->
    </template>
</VirtualBlock>

Unique virtual block

<VirtualBlock :height="300" :pageMode="false" :data="blocks">
    <template slot-scope="{data}">
        <template v-if="data.id === 0">
            <!-- virtual block slot when id is 0 -->
        </template>
        <template v-if="data.id === 1">
            <!-- virtual block slot when id is 1 -->
        </template>
        <template v-else>
            <!-- other virtual block slots -->
        </template>
    </template>
</VirtualBlock>

Props

Name Type Default Description
data Array<DataObject> - Required. An Array of Object used as the source data.
height Number - Required when pageMode is false. The height of the virtual block container.
fixedBlockHeight Number - Optional. Specify this prop will assume every block has the same height value and the height keys in data object will be ignored. Note use fixedBlockHeight will improve the performance.
pageMode Boolean true Optional. true assumes the scroller will be on the window. false assumes the scroller will be on the virtual block container.

DataObject

Name Type Default Description
id String/Number - Required. Unique key for each virtual block.
height Number - Required when prop fixedBlockHeight is not specified. The height of each virtual block.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].