index.html 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Vue.js tree-view demo</title>
  6. <style>
  7. body {
  8. font-family: Menlo, Consolas, monospace;
  9. color: #444;
  10. }
  11. .item {
  12. cursor: pointer;
  13. }
  14. .bold {
  15. font-weight: bold;
  16. }
  17. ul {
  18. padding-left: 1em;
  19. line-height: 1.5em;
  20. list-style-type: dot;
  21. }
  22. </style>
  23. <script src="../../dist/vue.js"></script>
  24. </head>
  25. <body>
  26. <!-- item template -->
  27. <script type="text/x-template" id="item-template">
  28. <div v-class="bold: isFolder"
  29. v-on="click: toggle, dblclick: changeType">
  30. {{model.name}}
  31. <span v-if="isFolder">[{{open ? '-' : '+'}}]</span>
  32. </div>
  33. <ul v-show="open" v-if="isFolder">
  34. <li class="item"
  35. v-repeat="model: model.children"
  36. v-component="item">
  37. </li>
  38. <li v-on="click: addChild">+</li>
  39. </ul>
  40. </script>
  41. <p>(You can double click on an item to turn it into a folder.)</p>
  42. <!-- the demo root element -->
  43. <ul id="demo">
  44. <li class="item"
  45. v-component="item"
  46. v-with="model: treeData">
  47. </li>
  48. </ul>
  49. <!-- demo code -->
  50. <script src="tree.js"></script>
  51. </body>
  52. </html>