Vue.jsでドラッグ可能なTreeを実装する「liquor-tree」
by kabanoki
HTML
<div id="app">
<tree
:options="options"
:data="items"
ref="tree"
></tree>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/liquor-tree/dist/liquor-tree.umd.js"></script>
CSS
body {
padding: 20px;
font-family: Helvetica;
}
#app {
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;
}
li {
margin: 8px 0;
}
h2 {
font-weight: bold;
margin-bottom: 15px;
}
del {
color: rgba(0, 0, 0, 0.3);
}
Vue
const LiquorTree = window['LiquorTree'];
Vue.use(LiquorTree);
new Vue({
el: '#app',
data: {
options: {
dnd: true
},
items: [
{text: 'Item 1'},
{text: 'Item 2'},
{text: 'Item 3', children: [
{text: 'Item 3.1'},
{text: 'Item 3.2'}
]}
]
},
});