add.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. Page({
  2. data: {
  3. treeList: [{
  4. id: '1',
  5. pid: '0',
  6. name: '祖先节点',
  7. nodes: [{
  8. id: '1-1',
  9. pid: '1',
  10. name: '父节点1',
  11. nodes: [{
  12. id: '1-1-1',
  13. pid: '1-1',
  14. name: '子节点1',
  15. nodes: [{
  16. id: '1-1-1-1',
  17. pid: '1',
  18. name: '父节点1',
  19. nodes: [{
  20. id: '1-1-1-1-1',
  21. pid: '1-1',
  22. name: '子节点1',
  23. nodes: []
  24. }]
  25. },
  26. {
  27. id: '1-1-2',
  28. pid: '1',
  29. name: '父节点2',
  30. nodes: [{
  31. id: '1-1-2',
  32. pid: '1-1',
  33. name: '子节点2',
  34. nodes: []
  35. }]
  36. }
  37. ]
  38. }]
  39. },
  40. {
  41. id: '1-2',
  42. pid: '1',
  43. name: '父节点2',
  44. nodes: [{
  45. id: '1-1-2',
  46. pid: '1-1',
  47. name: '子节点2',
  48. nodes: []
  49. }]
  50. }
  51. ]
  52. }]
  53. },
  54. treeClick(e) {
  55. console.log(e)
  56. const t = this.selectAllComponents('#treeSelect');
  57. t.forEach(item => {
  58. item.click(e);
  59. console.log(e.detail)
  60. })
  61. const {
  62. id,
  63. value
  64. } = e.detail;
  65. console.log(e.detail)
  66. }
  67. })