tree.jsx 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. import React from 'react';
  2. import { Table } from '@douyinfe/semi-ui';
  3. 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. title: '描述',
  24. dataIndex: 'description',
  25. key: 'description',
  26. },
  27. {
  28. title: '默认值',
  29. dataIndex: 'default',
  30. key: 'default',
  31. width: 100,
  32. },
  33. ];
  34. const data = [
  35. {
  36. key: 1,
  37. dataKey: 'videos_info',
  38. name: '视频信息',
  39. type: 'Object 对象',
  40. description: '视频的元信息',
  41. default: '无',
  42. children: [
  43. {
  44. key: 11,
  45. dataKey: 'status',
  46. name: '视频状态',
  47. type: 'Enum <Integer> 枚举',
  48. description: '视频的可见、推荐状态',
  49. default: '1',
  50. },
  51. {
  52. key: 12,
  53. dataKey: 'vid',
  54. name: '视频 ID',
  55. type: 'String 字符串',
  56. description: '标识视频的唯一 ID',
  57. default: '无',
  58. children: [
  59. {
  60. dataKey: 'video_url',
  61. name: '视频地址',
  62. type: 'String 字符串',
  63. description: '视频的唯一链接',
  64. default: '无',
  65. },
  66. ],
  67. }
  68. ],
  69. },
  70. {
  71. key: 2,
  72. dataKey: 'text_info',
  73. name: '文本信息',
  74. type: 'Object 对象',
  75. description: '视频的元信息',
  76. default: '无',
  77. children: [
  78. {
  79. key: 21,
  80. dataKey: 'title',
  81. name: '视频标题',
  82. type: 'String 字符串',
  83. description: '视频的标题',
  84. default: '无',
  85. },
  86. {
  87. key: 22,
  88. dataKey: 'video_description',
  89. name: '视频描述',
  90. type: 'String 字符串',
  91. description: '视频的描述',
  92. default: '无',
  93. }
  94. ],
  95. },
  96. ];
  97. return (
  98. <Table
  99. columns={columns}
  100. defaultExpandAllRows
  101. dataSource={data}
  102. />
  103. );
  104. };
  105. render(App);