Vue Vue JSON Tree View
by kabanoki
HTML
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/vue-json-tree-view.min.js"></script>
<div id="app">
<tree-view :data="jsonSource" :options="{maxDepth: 3}"></tree-view>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
CSS
body {
background: #20262E;
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
Vue
Vue.use(TreeView);
new Vue({
el: '#app',
data: {
jsonSource: [
{id:1, text:'text1'},
{id:2, text:'text2'},
{id:3, text:'text3'},
{id:4, text:'text4'},
{id:5, list:[
{id:1, text:'text1'},
{id:2, text:'text2'},
{id:3, text:'text3'},
{id:4, list:[
{id:1, text:'text1'},
{id:2, text:'text2'},
{id:3, text:'text3'},
]},
]}
]
}
})