Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yuanfux/virtual-block

๐ŸŒˆvue-virtual-block render what's visible
https://github.com/yuanfux/virtual-block

virtual-list virtualscroll vue

Last synced: 7 days ago
JSON representation

๐ŸŒˆvue-virtual-block render what's visible

Awesome Lists containing this project

README

        

# virtual-block
[![npm version](https://badge.fury.io/js/virtual-block.svg)](https://badge.fury.io/js/virtual-block)

> ๐ŸŒˆRender what's visible

[Demo](https://yuanfux.github.io/virtual-block/)

## Install
```
npm i virtual-block
```

## Import
```javascript
import Vue from 'vue'
import VirtualBlock from 'virtual-block/dist'
Vue.use(VirtualBlock)
```

## Usage

### Page Mode
```html



```

### Container Mode
```html



```

### Fixed Block Height
```html



```

### Unique virtual block
```html











```

## Props
Name | Type | Default | Description
--- | --- | --- | ---
`data` | `Array` | - | **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