复杂表头

TIP

1.0.9+

  • 只要在配置中添加children层级嵌套即可

普通用法

复杂表头 - 图1

  1. <avue-crud :option="option" :data="data" ></avue-crud>
  2. <script>
  3. export default {
  4. data() {
  5. return {
  6. option: {
  7. border: true,
  8. index: true,
  9. expandLevel: 3,
  10. headerAlign: 'center',
  11. align: 'center',
  12. tree: true,
  13. labelWidth: 100,
  14. column: [{
  15. label: '姓名',
  16. prop: 'name',
  17. width:140,
  18. }, {
  19. label: '性别1',
  20. prop: 'sex',
  21. },
  22. {
  23. label: '自定义图标',
  24. prop: 'icon',
  25. type: "icon-select",
  26. iconList: [{
  27. label: '基本图表',
  28. list: ['el-icon-time', 'el-icon-bell', 'el-icon-star-on']
  29. }]
  30. }, {
  31. label: '复杂表头',
  32. children: [{
  33. label: '信息',
  34. children: [{
  35. label: '年龄',
  36. prop: 'age'
  37. }, {
  38. label: '手机号',
  39. prop: 'phone',
  40. }]
  41. }, {
  42. label: '级别',
  43. prop: 'grade',
  44. type: 'select',
  45. dicData: [{
  46. label: '测试',
  47. value: 1
  48. }]
  49. }]
  50. }, {
  51. label: '测试',
  52. prop: 'test',
  53. },
  54. {
  55. label: '手机信息1',
  56. prop: 'phone1'
  57. }],
  58. },
  59. data: [{
  60. name: '张三',
  61. age: 14,
  62. grade: 1,
  63. phone1: '17547400800',
  64. phone: '17547400800',
  65. icon: 'el-icon-time',
  66. test: 1,
  67. sex: '男'
  68. }, {
  69. name: '王五',
  70. age: 10,
  71. grade: 1,
  72. test: 1,
  73. sex: '女',
  74. icon: 'el-icon-star-on',
  75. phone1: '17547400800',
  76. phone: '17547400800'
  77. }]
  78. }
  79. }
  80. }
  81. </script>