demo2.vue 802 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <template>
  2. <m-tree :data="list" label="name" children="children" show-checkbox></m-tree>
  3. </template>
  4. <script setup>
  5. const list = [
  6. {
  7. name: '一级 1',
  8. children: [
  9. {
  10. name: '二级 1-1',
  11. children: [
  12. {
  13. name: '三级 1-1-1'
  14. },
  15. {
  16. name: '三级 1-1-2'
  17. }
  18. ]
  19. },
  20. {
  21. name: '二级 1-2'
  22. }
  23. ]
  24. },
  25. {
  26. name: '一级 2',
  27. children: [
  28. {
  29. name: '二级 2-1',
  30. children: [
  31. {
  32. name: '三级 2-1-1'
  33. }
  34. ]
  35. },
  36. {
  37. name: '二级 2-2'
  38. }
  39. ]
  40. },
  41. {
  42. name: '一级 3',
  43. children: [
  44. {
  45. name: '二级 3-1'
  46. },
  47. {
  48. name: '二级 3-2'
  49. }
  50. ]
  51. }
  52. ]
  53. </script>