index.jsx 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import React from 'react';
  2. import { Table } from '../../../../index';
  3. class PerfVirtualized extends React.Component {
  4. constructor(props = {}) {
  5. super(props);
  6. this.columns = [
  7. {
  8. title: 'A',
  9. dataIndex: 'key',
  10. key: 'a',
  11. width: 150,
  12. },
  13. {
  14. title: 'B',
  15. dataIndex: 'key',
  16. key: 'b',
  17. },
  18. {
  19. title: 'C',
  20. dataIndex: 'key',
  21. key: 'c',
  22. },
  23. {
  24. title: 'D',
  25. dataIndex: 'key',
  26. key: 'd',
  27. },
  28. {
  29. title: 'E',
  30. dataIndex: 'key',
  31. width: 200,
  32. key: 'e',
  33. },
  34. {
  35. title: 'F',
  36. dataIndex: 'key',
  37. width: 100,
  38. key: 'f'
  39. },
  40. ];
  41. this.data = Array.from(
  42. {
  43. length: 100000,
  44. },
  45. (_, key) => ({
  46. key,
  47. })
  48. );
  49. this.scroll = { y: 300, x: '100vw' };
  50. }
  51. render() {
  52. return (
  53. <Table
  54. title="10万条数据"
  55. size={'small'}
  56. pagination={false}
  57. columns={this.columns}
  58. dataSource={this.data}
  59. scroll={this.scroll}
  60. virtualized
  61. />
  62. );
  63. }
  64. }
  65. export default PerfVirtualized;