UNPKG

sl-vue-tree

Version:

draggable tree vue component

119 lines (92 loc) 2.08 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>sl-vue-tree</title> <link rel="stylesheet" href="../dist/sl-vue-tree-dark.css"> <link href="https://use.fontawesome.com/releases/v5.0.8/css/all.css" rel="stylesheet"> <script src="./polyfill.js"></script> <script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script> <script src="../dist/sl-vue-tree.js"></script> </head> <body> <div id="app" > <h2> Sl-vue-tree - IE11-friendly code</h2> <div class="row"> <div class="tree-container"> <sl-vue-tree v-model="nodes" ref="slVueTree" > </sl-vue-tree> </div> <div class="json-preview"> <pre>{{ JSON.stringify(nodes, null, 4)}}</pre> </div> </div> </div> <script> var nodes = [ {title: 'Item1', isLeaf: true}, {title: 'Item2', isLeaf: true}, { title: 'Folder1', isExpanded: false, children: [ {title: 'Item3', isLeaf: true}, {title: 'Item4', isLeaf: true}, { title: 'Folder2', children: [ {title: 'Item5', isLeaf: true} ] } ] }, {title: 'Item6', isLeaf: true} ]; new Vue({ el: '#app', components: { SlVueTree: SlVueTree }, data: function () { return { nodes: nodes } }, }) </script> <style> body { background: #050d12; font-family: Arial; color: rgba(255, 255, 255, 0.5); } a { color: #bbb; } .row { display: flex; margin-bottom: 10px; } .tree-container { flex-grow: 1; } .sl-vue-tree.sl-vue-tree-root { flex-grow: 1; overflow-x: hidden; overflow-y: auto; height: 300px; } .json-preview { flex-grow: 1; margin-left: 10px; background-color: #13242d; border: 1px solid black; padding: 10px; } .item-icon { display: inline-block; text-align: left; width: 20px; } </style> </body> </html>