react Table虚拟滚动

Antd的表格组件有各种高级的用法,但遇到超过 1000条的数据,就会遇到性能问题,
这是就要考虑添加虚拟滚动特性,所以一开始就考虑了表格的性能

虚拟滚动相关的场景

  1. 无限滚动下拉框 https://github.com/bvaughn/react-virtualized-select

无限滚动Select

https://github.com/bvaughn/react-virtualized-select
http://bvaughn.github.io/react-virtualized-select/
image.png

  1. npm install react-virtualized-select
  2. // This only needs to be done once; probably during bootstrapping process.
  3. import "react-select/dist/react-select.css";
  4. import "react-virtualized-select/styles.css";
  5. import React from "react";
  6. import ReactDOM from "react-dom";
  7. import Select from "react-virtualized-select";
  8. // Dummy array of test values.
  9. const options = Array.from(new Array(1000), (_, index) => ({
  10. label: `Item ${index}`,
  11. value: index
  12. }));
  13. ReactDOM.render(
  14. <Select options={options} />,
  15. document.getElementById("root")
  16. );

无限滚动的复选框

https://github.com/emilebres/react-virtualized-checkbox

  1. yarn add react-virtualized-checkbox

无限滚动的日历

react-infinite-calendar:
https://clauderic.github.io/react-infinite-calendar/#/basic-settings/min-date

  1. npm install react-infinite-calendar
  2. import React from 'react';
  3. import { render } from 'react-dom';
  4. import InfiniteCalendar from 'react-infinite-calendar';
  5. import 'react-infinite-calendar/styles.css'; // only needs to be imported once
  6. // Render the Calendar
  7. var today = new Date();
  8. var lastWeek = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 7);
  9. render(
  10. <InfiniteCalendar
  11. width={400}
  12. height={600}
  13. selected={today}
  14. disabledDays={[0,6]}
  15. minDate={lastWeek}
  16. />,
  17. document.getElementById('root')
  18. );

react-timeline

react-timeline-9000:
A calendar timeline component that is capable of displaying and interacting with a large number of items
http://react-timeline-9000.s3-website-ap-southeast-2.amazonaws.com/
image.png