index.tsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import React from 'react';
  2. import { Table } from '@douyinfe/semi-ui';
  3. export default function App() {
  4. const columns = [
  5. {
  6. title: 'Key',
  7. dataIndex: 'dataKey',
  8. key: 'dataKey',
  9. },
  10. {
  11. title: '名称',
  12. dataIndex: 'name',
  13. key: 'name',
  14. width: 200,
  15. },
  16. {
  17. title: '数据类型',
  18. dataIndex: 'type',
  19. key: 'type',
  20. width: 400,
  21. },
  22. ];
  23. const data = [
  24. {
  25. key: 99,
  26. dataKey: 99,
  27. name: 'row 99',
  28. children: [],
  29. },
  30. {
  31. key: 2,
  32. dataKey: 'text_info',
  33. name: '文本信息',
  34. type: 'Object 对象',
  35. description: '视频的元信息',
  36. default: '无',
  37. children: [
  38. {
  39. key: 21,
  40. dataKey: 'title',
  41. name: '视频标题',
  42. type: 'String 字符串',
  43. description: '视频的标题',
  44. default: '无',
  45. },
  46. ],
  47. },
  48. ];
  49. return <div>
  50. <Table expandIcon={false} defaultExpandAllRows columns={columns} dataSource={data} />
  51. <Table defaultExpandAllRows columns={columns} dataSource={data} />
  52. </div>;
  53. }