Treeview - 图1

Treeview

Treeview Layout

  1. <!-- Treeview container -->
  2. <div class="treeview">
  3. <!-- Treeview item -->
  4. <div class="treeview-item">
  5. <!-- Item root element -->
  6. <div class="treeview-item-root">
  7. <!-- Item toggle (to open children on click) -->
  8. <div class="treeview-toggle"></div>
  9. <!-- Item content -->
  10. <div class="treeview-item-content">
  11. <!-- Item checkbox (optional) -->
  12. <label class="checkbox">...</label>
  13. <!-- Item icon (optional) -->
  14. <i class="icon f7-icons">folder_fill</i>
  15. <!-- Item label -->
  16. <div class="treeview-item-label">Item 1</div>
  17. </div>
  18. </div>
  19. <!-- Item children -->
  20. <div class="treeview-item-children">
  21. <!-- Children item. It has same recursive layout -->
  22. <div class="treeview-item">
  23. <div class="treeview-item-root">
  24. ...
  25. </div>
  26. <div class="treeview-item-children">
  27. ...
  28. </div>
  29. </div>
  30. <!-- Another children item -->
  31. <div class="treeview-item">...</div>
  32. </div>
  33. </div>
  34. <!-- Another item -->
  35. <div class="treeview-item">...</div>
  36. <!-- Item without children -->
  37. <div class="treeview-item">
  38. <div class="treeview-item-root">
  39. <div class="treeview-item-content">
  40. <div class="treeview-item-label">Item 3</div>
  41. </div>
  42. </div>
  43. </div>
  44. </div>

Treeview Item Link

If we need some treeview item to be just a link, we just need to use <a> tag for treeview-item-root element:

  1. <div class="treeview">
  2. ...
  3. <div class="treeview-item">
  4. <a href="/about/" class="treeview-item-root">
  5. <div class="treeview-item-content">
  6. <i class="icon f7-icons">link</i>
  7. <div class="treeview-item-label">About</div>
  8. </div>
  9. </a>
  10. </div>
  11. ...
  12. </div>

Treeview Item Toggle

Instead of toggle (or in addition) button, we can make whole treeview item work like a toggle. In this case we need to add treeview-item-toggle to treeview item root element:

  1. <div class="treeview">
  2. ...
  3. <div class="treeview-item">
  4. <!-- additional "treeview-item-toggle" class -->
  5. <div class="treeview-item-root treeview-item-toggle">
  6. <div class="treeview-toggle"></div>
  7. <div class="treeview-item-content">
  8. <i class="icon f7-icons">folder_fill</i>
  9. <div class="treeview-item-label">images</div>
  10. </div>
  11. </div>
  12. <div class="treeview-item-children">
  13. ...
  14. </div>
  15. </div>
  16. ...
  17. </div>

Treeview Selectable Item

We can also make treeview item selectable. In this case we need to add treeview-item-selectable to treeview item root element, and treeview-item-selected to selected item root element:

  1. <div class="treeview">
  2. ...
  3. <div class="treeview-item">
  4. <!-- additional "treeview-item-selectable" class -->
  5. <div class="treeview-item-root treeview-item-selectable">
  6. <div class="treeview-toggle"></div>
  7. <div class="treeview-item-content">
  8. <i class="icon f7-icons">folder_fill</i>
  9. <div class="treeview-item-label">images</div>
  10. </div>
  11. </div>
  12. <div class="treeview-item-children">
  13. ...
  14. </div>
  15. </div>
  16. <div class="treeview-item">
  17. <!-- additional "treeview-item-selected" class on selected item -->
  18. <div class="treeview-item-root treeview-item-selectable treeview-item-selected">
  19. <div class="treeview-toggle"></div>
  20. <div class="treeview-item-content">
  21. <i class="icon f7-icons">folder_fill</i>
  22. <div class="treeview-item-label">documents</div>
  23. </div>
  24. </div>
  25. <div class="treeview-item-children">
  26. ...
  27. </div>
  28. </div>
  29. ...
  30. </div>

Treeview App Methods

Let’s look at related App methods to work with Treeview:

app.treeview.open(el)- open (expand) Treeview item

  • el - HTMLElement or string (with CSS Selector). Treeview item element to open.

app.treeview.close(el)- close (collapse) Treeview item

  • el - HTMLElement or string (with CSS Selector). Treeview item element to close.

app.treeview.toggle(el)- toggle (open or close) Treeview item

  • el - HTMLElement or string (with CSS Selector). Treeview item element to toggle.

Treeview Events

Sheet will fire the following DOM events on sheet element and events on app and sheet instance:

DOM Events

EventTargetDescription
treeview:openTreeview Item Element<div class=”treeview-item”>Event will be triggered on Treeview item open
treeview:closeTreeview Item Element<div class=”treeview-item”>Event will be triggered on Treeview item close
treeview:loadchildrenTreeview Item Element<div class=”treeview-item”>Event will be triggered on first open of Treeview item with treeview-load-children class. In event.detail it contains function to hide loading preloader.

App Events

Treeview also emits events on app instance.

EventTargetDescription
treeviewOpen(itemEl)appEvent will be triggered on Treeview item open
treeviewClose(itemEl)appEvent will be triggered on Treeview item close
treeviewLoadChildren(itemEl, done)appEvent will be triggered on first open of Treeview item with treeview-load-children class. As second argument it has function to hide loading preloader.

Load Children

It is also possible to load children on treeview item open. To make it work, we, at first, need to add treeview-load-children class to such treeview item. And then listen for treeview:loadchildren event to proceed with loading. Check the examples below for implementation example.

CSS Variables

Below is the list of related CSS variables (CSS custom properties).

Note that commented variables are not specified by default and their values is what they fallback to in this case.

  1. :root {
  2. --f7-treeview-toggle-size: 24px;
  3. --f7-treeview-toggle-color: rgba(0, 0, 0, 0.5);
  4. --f7-treeview-toggle-hover-bg-color: rgba(0, 0, 0, 0.1);
  5. --f7-treeview-toggle-pressed-bg-color: rgba(0, 0, 0, 0.15);
  6. --f7-treeview-icon-color: rgba(0, 0, 0, 0.5);
  7. --f7-treeview-children-offset: 29px;
  8. --f7-treeview-label-font-weight: 400;
  9. --f7-treeview-label-text-color: inherit;
  10. --f7-treeview-selectable-hover-bg-color: rgba(0, 0, 0, 0.1);
  11. /*
  12. --f7-treeview-selectable-selected-bg-color: rgba(var(--f7-theme-color-rgb), 0.2);
  13. */
  14. --f7-treeview-link-hover-bg-color: rgba(0, 0, 0, 0.1);
  15. --f7-treeview-link-pressed-bg-color: rgba(0, 0, 0, 0.15);
  16. }
  17. :root .theme-dark,
  18. :root.theme-dark {
  19. --f7-treeview-toggle-color: rgba(255, 255, 255, 0.5);
  20. --f7-treeview-toggle-hover-bg-color: rgba(255, 255, 255, 0.03);
  21. --f7-treeview-toggle-pressed-bg-color: rgba(255, 255, 255, 0.1);
  22. --f7-treeview-icon-color: rgba(255, 255, 255, 0.75);
  23. --f7-treeview-selectable-hover-bg-color: rgba(255, 255, 255, 0.03);
  24. --f7-treeview-link-hover-bg-color: rgba(255, 255, 255, 0.03);
  25. --f7-treeview-link-pressed-bg-color: rgba(255, 255, 255, 0.11);
  26. }
  27. .ios {
  28. --f7-treeview-item-height: 34px;
  29. --f7-treeview-item-padding-left: 15px;
  30. --f7-treeview-item-padding-right: 15px;
  31. --f7-treeview-label-font-size: 17px;
  32. --f7-treeview-icon-size: 24px;
  33. }
  34. .md {
  35. --f7-treeview-item-height: 34px;
  36. --f7-treeview-item-padding-left: 16px;
  37. --f7-treeview-item-padding-right: 16px;
  38. --f7-treeview-label-font-size: 16px;
  39. --f7-treeview-icon-size: 24px;
  40. }
  41. .aurora {
  42. --f7-treeview-item-height: 28px;
  43. --f7-treeview-item-padding-left: 15px;
  44. --f7-treeview-item-padding-right: 15px;
  45. --f7-treeview-label-font-size: 14px;
  46. --f7-treeview-icon-size: 20px;
  47. }

Examples

Basic Tree View

  1. <div class="treeview">
  2. <div class="treeview-item">
  3. <div class="treeview-item-root">
  4. <div class="treeview-toggle"></div>
  5. <div class="treeview-item-content">
  6. <div class="treeview-item-label">Item 1</div>
  7. </div>
  8. </div>
  9. <div class="treeview-item-children">
  10. <div class="treeview-item">
  11. <div class="treeview-item-root">
  12. <div class="treeview-toggle"></div>
  13. <div class="treeview-item-content">
  14. <div class="treeview-item-label">Sub Item 1</div>
  15. </div>
  16. </div>
  17. <div class="treeview-item-children">
  18. <div class="treeview-item">
  19. <div class="treeview-item-root">
  20. <div class="treeview-item-content">
  21. <div class="treeview-item-label">Sub Sub Item 1</div>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="treeview-item">
  26. <div class="treeview-item-root">
  27. <div class="treeview-item-content">
  28. <div class="treeview-item-label">Sub Sub Item 2</div>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. <div class="treeview-item">
  35. <div class="treeview-item-root">
  36. <div class="treeview-toggle"></div>
  37. <div class="treeview-item-content">
  38. <div class="treeview-item-label">Sub Item 2</div>
  39. </div>
  40. </div>
  41. <div class="treeview-item-children">
  42. <div class="treeview-item">
  43. <div class="treeview-item-root">
  44. <div class="treeview-item-content">
  45. <div class="treeview-item-label">Sub Sub Item 1</div>
  46. </div>
  47. </div>
  48. </div>
  49. <div class="treeview-item">
  50. <div class="treeview-item-root">
  51. <div class="treeview-item-content">
  52. <div class="treeview-item-label">Sub Sub Item 2</div>
  53. </div>
  54. </div>
  55. </div>
  56. </div>
  57. </div>
  58. </div>
  59. </div>
  60. <div class="treeview-item">
  61. <div class="treeview-item-root">
  62. <div class="treeview-toggle"></div>
  63. <div class="treeview-item-content">
  64. <div class="treeview-item-label">Item 2</div>
  65. </div>
  66. </div>
  67. <div class="treeview-item-children">
  68. <div class="treeview-item">
  69. <div class="treeview-item-root">
  70. <div class="treeview-toggle"></div>
  71. <div class="treeview-item-content">
  72. <div class="treeview-item-label">Sub Item 1</div>
  73. </div>
  74. </div>
  75. <div class="treeview-item-children">
  76. <div class="treeview-item">
  77. <div class="treeview-item-root">
  78. <div class="treeview-item-content">
  79. <div class="treeview-item-label">Sub Sub Item 1</div>
  80. </div>
  81. </div>
  82. </div>
  83. <div class="treeview-item">
  84. <div class="treeview-item-root">
  85. <div class="treeview-item-content">
  86. <div class="treeview-item-label">Sub Sub Item 2</div>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="treeview-item">
  93. <div class="treeview-item-root">
  94. <div class="treeview-toggle"></div>
  95. <div class="treeview-item-content">
  96. <div class="treeview-item-label">Sub Item 2</div>
  97. </div>
  98. </div>
  99. <div class="treeview-item-children">
  100. <div class="treeview-item">
  101. <div class="treeview-item-root">
  102. <div class="treeview-item-content">
  103. <div class="treeview-item-label">Sub Sub Item 1</div>
  104. </div>
  105. </div>
  106. </div>
  107. <div class="treeview-item">
  108. <div class="treeview-item-root">
  109. <div class="treeview-item-content">
  110. <div class="treeview-item-label">Sub Sub Item 2</div>
  111. </div>
  112. </div>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </div>
  118. <div class="treeview-item">
  119. <div class="treeview-item-root">
  120. <div class="treeview-item-content">
  121. <div class="treeview-item-label">Item 3</div>
  122. </div>
  123. </div>
  124. </div>
  125. </div>

With Icons

  1. <div class="treeview">
  2. <div class="treeview-item">
  3. <div class="treeview-item-root">
  4. <div class="treeview-toggle"></div>
  5. <div class="treeview-item-content">
  6. <i class="icon f7-icons">folder_fill</i>
  7. <div class="treeview-item-label">images</div>
  8. </div>
  9. </div>
  10. <div class="treeview-item-children">
  11. <div class="treeview-item">
  12. <div class="treeview-item-root">
  13. <div class="treeview-item-content">
  14. <i class="icon f7-icons">images_fill</i>
  15. <div class="treeview-item-label">avatar.png</div>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="treeview-item">
  20. <div class="treeview-item-root">
  21. <div class="treeview-item-content">
  22. <i class="icon f7-icons">images_fill</i>
  23. <div class="treeview-item-label">background.jpg</div>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="treeview-item">
  30. <div class="treeview-item-root">
  31. <div class="treeview-toggle"></div>
  32. <div class="treeview-item-content">
  33. <i class="icon f7-icons">folder_fill</i>
  34. <div class="treeview-item-label">documents</div>
  35. </div>
  36. </div>
  37. <div class="treeview-item-children">
  38. <div class="treeview-item">
  39. <div class="treeview-item-root">
  40. <div class="treeview-item-content">
  41. <i class="icon f7-icons">document_text_fill</i>
  42. <div class="treeview-item-label">cv.docx</div>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="treeview-item">
  47. <div class="treeview-item-root">
  48. <div class="treeview-item-content">
  49. <i class="icon f7-icons">document_text_fill</i>
  50. <div class="treeview-item-label">info.docx</div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="treeview-item">
  57. <div class="treeview-item-root">
  58. <div class="treeview-item-content">
  59. <i class="icon f7-icons">logo_github</i>
  60. <div class="treeview-item-label">.gitignore</div>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="treeview-item">
  65. <div class="treeview-item-root">
  66. <div class="treeview-item-content">
  67. <i class="icon f7-icons">document_text_fill</i>
  68. <div class="treeview-item-label">index.html</div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>

With Checkboxes

  1. <div class="treeview">
  2. <div class="treeview-item">
  3. <div class="treeview-item-root">
  4. <div class="treeview-toggle"></div>
  5. <div class="treeview-item-content">
  6. <label class="checkbox">
  7. <input type="checkbox">
  8. <i class="icon-checkbox"></i>
  9. </label>
  10. <i class="icon f7-icons">folder_fill</i>
  11. <div class="treeview-item-label">images</div>
  12. </div>
  13. </div>
  14. <div class="treeview-item-children">
  15. <div class="treeview-item">
  16. <div class="treeview-item-root">
  17. <div class="treeview-item-content">
  18. <label class="checkbox">
  19. <input type="checkbox">
  20. <i class="icon-checkbox"></i>
  21. </label>
  22. <i class="icon f7-icons">images_fill</i>
  23. <div class="treeview-item-label">avatar.png</div>
  24. </div>
  25. </div>
  26. </div>
  27. <div class="treeview-item">
  28. <div class="treeview-item-root">
  29. <div class="treeview-item-content">
  30. <label class="checkbox">
  31. <input type="checkbox">
  32. <i class="icon-checkbox"></i>
  33. </label>
  34. <i class="icon f7-icons">images_fill</i>
  35. <div class="treeview-item-label">background.jpg</div>
  36. </div>
  37. </div>
  38. </div>
  39. </div>
  40. </div>
  41. <div class="treeview-item">
  42. <div class="treeview-item-root">
  43. <div class="treeview-toggle"></div>
  44. <div class="treeview-item-content">
  45. <label class="checkbox">
  46. <input type="checkbox">
  47. <i class="icon-checkbox"></i>
  48. </label>
  49. <i class="icon f7-icons">folder_fill</i>
  50. <div class="treeview-item-label">documents</div>
  51. </div>
  52. </div>
  53. <div class="treeview-item-children">
  54. <div class="treeview-item">
  55. <div class="treeview-item-root">
  56. <div class="treeview-item-content">
  57. <label class="checkbox">
  58. <input type="checkbox">
  59. <i class="icon-checkbox"></i>
  60. </label>
  61. <i class="icon f7-icons">document_text_fill</i>
  62. <div class="treeview-item-label">cv.docx</div>
  63. </div>
  64. </div>
  65. </div>
  66. <div class="treeview-item">
  67. <div class="treeview-item-root">
  68. <div class="treeview-item-content">
  69. <label class="checkbox">
  70. <input type="checkbox">
  71. <i class="icon-checkbox"></i>
  72. </label>
  73. <i class="icon f7-icons">document_text_fill</i>
  74. <div class="treeview-item-label">info.docx</div>
  75. </div>
  76. </div>
  77. </div>
  78. </div>
  79. </div>
  80. <div class="treeview-item">
  81. <div class="treeview-item-root">
  82. <div class="treeview-item-content">
  83. <label class="checkbox">
  84. <input type="checkbox">
  85. <i class="icon-checkbox"></i>
  86. </label>
  87. <i class="icon f7-icons">logo_github</i>
  88. <div class="treeview-item-label">.gitignore</div>
  89. </div>
  90. </div>
  91. </div>
  92. <div class="treeview-item">
  93. <div class="treeview-item-root">
  94. <div class="treeview-item-content">
  95. <label class="checkbox">
  96. <input type="checkbox">
  97. <i class="icon-checkbox"></i>
  98. </label>
  99. <i class="icon f7-icons">document_text_fill</i>
  100. <div class="treeview-item-label">index.html</div>
  101. </div>
  102. </div>
  103. </div>
  104. </div>

Whole item as toggle

  1. <div class="treeview">
  2. <div class="treeview-item treeview-item-toggle">
  3. <div class="treeview-item-root">
  4. <div class="treeview-toggle"></div>
  5. <div class="treeview-item-content">
  6. <i class="icon f7-icons">folder_fill</i>
  7. <div class="treeview-item-label">images</div>
  8. </div>
  9. </div>
  10. <div class="treeview-item-children">
  11. <div class="treeview-item">
  12. <div class="treeview-item-root">
  13. <div class="treeview-item-content">
  14. <i class="icon f7-icons">images_fill</i>
  15. <div class="treeview-item-label">avatar.png</div>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="treeview-item">
  20. <div class="treeview-item-root">
  21. <div class="treeview-item-content">
  22. <i class="icon f7-icons">images_fill</i>
  23. <div class="treeview-item-label">background.jpg</div>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="treeview-item treeview-item-toggle">
  30. <div class="treeview-item-root">
  31. <div class="treeview-toggle"></div>
  32. <div class="treeview-item-content">
  33. <i class="icon f7-icons">folder_fill</i>
  34. <div class="treeview-item-label">documents</div>
  35. </div>
  36. </div>
  37. <div class="treeview-item-children">
  38. <div class="treeview-item">
  39. <div class="treeview-item-root">
  40. <div class="treeview-item-content">
  41. <i class="icon f7-icons">document_text_fill</i>
  42. <div class="treeview-item-label">cv.docx</div>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="treeview-item">
  47. <div class="treeview-item-root">
  48. <div class="treeview-item-content">
  49. <i class="icon f7-icons">document_text_fill</i>
  50. <div class="treeview-item-label">info.docx</div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="treeview-item">
  57. <div class="treeview-item-root">
  58. <div class="treeview-item-content">
  59. <i class="icon f7-icons">logo_github</i>
  60. <div class="treeview-item-label">.gitignore</div>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="treeview-item">
  65. <div class="treeview-item-root">
  66. <div class="treeview-item-content">
  67. <i class="icon f7-icons">document_text_fill</i>
  68. <div class="treeview-item-label">index.html</div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>

Selectable

  1. <div class="treeview">
  2. <div class="treeview-item">
  3. <div class="treeview-item-root treeview-item-selectable">
  4. <div class="treeview-toggle"></div>
  5. <div class="treeview-item-content">
  6. <i class="icon f7-icons">folder_fill</i>
  7. <div class="treeview-item-label">images</div>
  8. </div>
  9. </div>
  10. <div class="treeview-item-children">
  11. <div class="treeview-item">
  12. <div class="treeview-item-root treeview-item-selectable">
  13. <div class="treeview-item-content">
  14. <i class="icon f7-icons">images_fill</i>
  15. <div class="treeview-item-label">avatar.png</div>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="treeview-item">
  20. <div class="treeview-item-root treeview-item-selectable">
  21. <div class="treeview-item-content">
  22. <i class="icon f7-icons">images_fill</i>
  23. <div class="treeview-item-label">background.jpg</div>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. </div>
  29. <div class="treeview-item">
  30. <div class="treeview-item-root treeview-item-selectable">
  31. <div class="treeview-toggle"></div>
  32. <div class="treeview-item-content">
  33. <i class="icon f7-icons">folder_fill</i>
  34. <div class="treeview-item-label">documents</div>
  35. </div>
  36. </div>
  37. <div class="treeview-item-children">
  38. <div class="treeview-item">
  39. <div class="treeview-item-root treeview-item-selectable">
  40. <div class="treeview-item-content">
  41. <i class="icon f7-icons">document_text_fill</i>
  42. <div class="treeview-item-label">cv.docx</div>
  43. </div>
  44. </div>
  45. </div>
  46. <div class="treeview-item">
  47. <div class="treeview-item-root treeview-item-selectable">
  48. <div class="treeview-item-content">
  49. <i class="icon f7-icons">document_text_fill</i>
  50. <div class="treeview-item-label">info.docx</div>
  51. </div>
  52. </div>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="treeview-item">
  57. <div class="treeview-item-root treeview-item-selectable">
  58. <div class="treeview-item-content">
  59. <i class="icon f7-icons">logo_github</i>
  60. <div class="treeview-item-label">.gitignore</div>
  61. </div>
  62. </div>
  63. </div>
  64. <div class="treeview-item">
  65. <div class="treeview-item-root treeview-item-selectable">
  66. <div class="treeview-item-content">
  67. <i class="icon f7-icons">document_text_fill</i>
  68. <div class="treeview-item-label">index.html</div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  1. var $ = Dom7;
  2. $('.tree-view-item-selectable').on('click', function (e) {
  3. var $targetEl = $(e.target);
  4. if ($targetEl.closest('.treeview-item-selected').length) return;
  5. if ($targetEl.is('.treeview-toggle')) return;
  6. $targetEl.parents('.treeview').find('.treeview-item-selected').removeClass('treeview-item-selected')
  7. $targetEl.closest('.treeview-item-selectable').addClass('treeview-item-selected')
  8. })

Preload children

This example use Router Component syntax:

  1. <div class="treeview">
  2. <div class="treeview-item treeview-load-children" @treeview:loadchildren="loadChildren">
  3. <div class="treeview-item-root">
  4. <div class="treeview-toggle"></div>
  5. <div class="treeview-item-content">
  6. <i class="icon f7-icons">persons</i>
  7. <div class="treeview-item-label">Users</div>
  8. </div>
  9. </div>
  10. <div class="treeview-item-children">
  11. {{#each loadedChildren}}
  12. <div class="treeview-item">
  13. <div class="treeview-item-root">
  14. <div class="treeview-item-content">
  15. <i class="icon f7-icons">person</i>
  16. <div class="treeview-item-label">{{name}}</div>
  17. </div>
  18. </div>
  19. </div>
  20. {{/each}}
  21. </div>
  22. </div>
  23. </div>
  1. return {
  2. data: function () {
  3. return {
  4. loadedChildren: [],
  5. };
  6. },
  7. methods: {
  8. loadChildren: function (e) {
  9. var self = this;
  10. var done = e.detail;
  11. // emulate 2 seconds loading
  12. setTimeout(function () {
  13. // call done() to hide preloader
  14. done();
  15. self.$setState({
  16. loadedChildren: [
  17. {
  18. name: 'John Doe',
  19. },
  20. {
  21. name: 'Jane Doe',
  22. },
  23. {
  24. name: 'Calvin Johnson',
  25. },
  26. ]
  27. })
  28. }, 2000);
  29. },
  30. },
  31. }

With links

  1. <div class="treeview">
  2. <div class="treeview-item">
  3. <div class="treeview-item-root treeview-item-toggle">
  4. <div class="treeview-toggle"></div>
  5. <div class="treeview-item-content">
  6. <i class="icon f7-icons">data_fill</i>
  7. <div class="treeview-item-label">Modals</div>
  8. </div>
  9. </div>
  10. <div class="treeview-item-children">
  11. <div class="treeview-item">
  12. <a href="/popup/" class="treeview-item-root">
  13. <div class="treeview-item-content">
  14. <i class="icon f7-icons">link</i>
  15. <div class="treeview-item-label">Popup</div>
  16. </div>
  17. </a>
  18. </div>
  19. <div class="treeview-item">
  20. <a href="/dialog/" class="treeview-item-root">
  21. <div class="treeview-item-content">
  22. <i class="icon f7-icons">link</i>
  23. <div class="treeview-item-label">Dialog</div>
  24. </div>
  25. </a>
  26. </div>
  27. <div class="treeview-item">
  28. <a href="/action-sheet/" class="treeview-item-root">
  29. <div class="treeview-item-content">
  30. <i class="icon f7-icons">link</i>
  31. <div class="treeview-item-label">Action Sheet</div>
  32. </div>
  33. </a>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="treeview-item">
  38. <div class="treeview-item-root treeview-item-toggle">
  39. <div class="treeview-toggle"></div>
  40. <div class="treeview-item-content">
  41. <i class="icon f7-icons">data_fill</i>
  42. <div class="treeview-item-label">Navigation Bars</div>
  43. </div>
  44. </div>
  45. <div class="treeview-item-children">
  46. <div class="treeview-item">
  47. <a href="/navbar/" class="treeview-item-root">
  48. <div class="treeview-item-content">
  49. <i class="icon f7-icons">link</i>
  50. <div class="treeview-item-label">Navbar</div>
  51. </div>
  52. </a>
  53. </div>
  54. <div class="treeview-item">
  55. <a href="/toolbar-tabbar/" class="treeview-item-root">
  56. <div class="treeview-item-content">
  57. <i class="icon f7-icons">link</i>
  58. <div class="treeview-item-label">Toolbar & Tabbar</div>
  59. </div>
  60. </a>
  61. </div>
  62. </div>
  63. </div>
  64. </div>