UNPKG

3.2 kBMarkdownView Raw
1
2<p align="center">
3 <a href="#">
4 <img width="300" src="https://raw.githubusercontent.com/PengChen96/virtualized-table/master/logo.png"/>
5 </a>
6 <h1 align="center">virtualized-table</h1>
7</p>
8
9[![npm version](https://badge.fury.io/js/virtualized-table.svg)](http://badge.fury.io/js/virtualized-table)
10[![Build Status](https://travis-ci.com/PengChen96/virtualized-table.svg?branch=master)](https://travis-ci.com/github/PengChen96/virtualized-table)
11[![codecov](https://codecov.io/gh/PengChen96/virtualized-table/branch/master/graph/badge.svg)](https://codecov.io/gh/PengChen96/virtualized-table)
12[![NPM downloads](http://img.shields.io/npm/dm/virtualized-table.svg?style=flat-square)](https://www.npmjs.com/package/virtualized-table)
13大数据量虚拟化表格组件
14
15## Usage
16
17### Install
18```
19$ npm install virtualized-table
20```
21
22### Example
23```javascript
24 import {VTable} from "virtualized-table";
25
26 <VTable
27 columns={columns}
28 dataSource={dataSource}
29 fixedLeftColumnCount={2}
30 />
31```
32[完整示例](https://github.com/PengChen96/virtualized-table/blob/master/src/example/VTable/index.js)
33
34### API
35#### VTable
36参数 | 说明 | 类型 | 默认值
37---|---|---|---
38columns | 表格列 | array | []
39dataSource | 表格数据 | array | []
40fixedLeftColumnCount | 左边固定列 列数 | number | 0
41fixedRightColumnCount | 右边固定列 列数 | number | 0
42visibleWidth | 可视区域宽度 | number | 1200
43visibleHeight | 可视区域高度 | number | 400
44mainRowHeight | 表格主内容行高 | number | 40
45columnOffsetCount | 左右列偏移量 | number | 4
46emptyText | 空数据渲染 | element | -
47rowSelection | 勾选 | object | -
48onCellTap | 点击每个子项 | func | Function(value, row, rowIndex, realRowIndex, column, columnIndex, realColumnIndex)
49onSelectAll | 勾选全部 | func | Function(selected, selectedRows)
50onSelect | 勾选行 | func | Function(record, selected, selectedRows)
51rowKey | 行键 | string | index
52onRowRemove | 删除行 | func | Function(e, row, rowIndex, realRowIndex)
53rowRemoveText | 删除行内容 | element | -
54rowRemoveVisible | 是否显示删除按钮 | bool | true
55className | .v-table样式 | string | -
56loading | 是否显示加载中 | bool | false
57loadingText | 加载中内容 | element | "数据加载中,请稍后.."
58rowActiveKey | 标记行的键 | string | "active"
59rowActiveColor | 标记行的颜色 | string | "#fff1f0"
60footerColumnData | 固定底部行数据 | array | -
61pointerEventDisabled | 禁止鼠标事件 | bool | false
62
63#### columns
64参数 | 说明 | 类型 | 默认值
65---|---|---|---
66key | 键 | string | -
67title | 列头显示文字 | string | -
68width | 列宽度 | number | 150
69style | 样式 | object | -
70render | 数据渲染函数 | func | Function(value, row, rowIndex, realRowIndex, column, columnIndex, realColumnIndex)
71headRender | 渲染表头函数 | func | Function(value, row, rowIndex, realRowIndex, column, columnIndex, realColumnIndex)
72className | 单元格样式 | string | -
73headerClassName | 表头样式(不设置会默认className) | string | -
74subColumns | 二级表头(属性跟columns一致) | array | -
75
76## License
77virtualized-table is available under the MIT License.