表格树

例子

表格树 - 图1

传入option配置属性即可,expandAll是否全部展开,columns数据列,data为数据,同时还支持自定义列,具体看avue-clidemo

  1. <avue-tree-table :option="option"></avue-tree-table>
  2. <script>
  3. export default {
  4. data () {
  5. return {
  6. option: {
  7. expandAll: false,
  8. columns: [
  9. {
  10. text: '事件',
  11. value: 'event',
  12. width: 200
  13. },
  14. {
  15. text: 'ID',
  16. value: 'id',
  17. type:'dic',
  18. dicData:[{
  19. label:'零',
  20. value:0
  21. },{
  22. label:'一',
  23. value:1
  24. },{
  25. label:'二',
  26. value:2,
  27. }]
  28. },
  29. {
  30. text: '时间线',
  31. value: 'timeLine'
  32. },
  33. {
  34. text: '备注',
  35. value: 'comment'
  36. }
  37. ],
  38. data: [
  39. {
  40. id: 0,
  41. event: '事件1',
  42. timeLine: 50,
  43. comment: '无'
  44. },
  45. {
  46. id: 1,
  47. event: '事件1',
  48. timeLine: 100,
  49. comment: '无',
  50. children: [
  51. {
  52. id: 2,
  53. event: '事件2',
  54. timeLine: 10,
  55. comment: '无'
  56. },
  57. {
  58. id: 3,
  59. event: '事件3',
  60. timeLine: 90,
  61. comment: '无',
  62. children: [
  63. {
  64. id: 4,
  65. event: '事件4',
  66. timeLine: 5,
  67. comment: '无'
  68. },
  69. {
  70. id: 5,
  71. event: '事件5',
  72. timeLine: 10,
  73. comment: '无'
  74. },
  75. {
  76. id: 6,
  77. event: '事件6',
  78. timeLine: 75,
  79. comment: '无',
  80. children: [
  81. {
  82. id: 7,
  83. event: '事件7',
  84. timeLine: 50,
  85. comment: '无',
  86. children: [
  87. {
  88. id: 71,
  89. event: '事件71',
  90. timeLine: 25,
  91. comment: 'xx'
  92. },
  93. {
  94. id: 72,
  95. event: '事件72',
  96. timeLine: 5,
  97. comment: 'xx'
  98. },
  99. {
  100. id: 73,
  101. event: '事件73',
  102. timeLine: 20,
  103. comment: 'xx'
  104. }
  105. ]
  106. },
  107. {
  108. id: 8,
  109. event: '事件8',
  110. timeLine: 25,
  111. comment: '无'
  112. }
  113. ]
  114. }
  115. ]
  116. }
  117. ]
  118. }
  119. ]
  120. }
  121. }
  122. }
  123. }
  124. </script>