Improved tree view

This commit is contained in:
Stefan Zermatten
2019-04-24 13:22:31 +02:00
parent fc24cf4a5b
commit e71bfb2691
5 changed files with 106 additions and 68 deletions

View File

@@ -13,23 +13,11 @@
</div>
<v-expand-transition>
<div v-if="showExpanded">
<draggable
:list="children"
class="drag-area layout column"
<tree-node-list
:children="children"
:group="group"
:animation="200"
ghost-class="ghost"
draggable=".item"
>
<tree-node
v-for="child in children"
v-bind="child"
:group="group"
:key="child.name"
class="item"
@dragstart.native="e => e.dataTransfer.setData('cow', 'moooooo')"
/>
</draggable>
:show-empty="showEmpty"
/>
</div>
</v-expand-transition>
</div>
@@ -48,6 +36,9 @@
components: {
draggable,
},
beforeCreate() {
this.$options.components.TreeNodeList = require('./TreeNodeList.vue').default
},
data(){ return {
expanded: false,
}},
@@ -68,11 +59,6 @@
return this.expanded && (this.showEmpty || this.hasChildren)
},
},
methods: {
dragstart(){
console.log(arguments);
},
}
};
</script>
@@ -82,11 +68,11 @@
}
.drag-area {
min-height: 40px;
box-shadow: -2px 0px 0px 0px #808080, 2px 0px 0px 0px #808080;
box-shadow: -2px 0px 0px 0px #808080;
margin-left: 23px;
}
.empty .drag-area {
box-shadow: -2px 0px 0px 0px rgb(128, 128, 128, 0.4), 2px 0px 0px 0px rgb(128, 128, 128, 0.4);
box-shadow: -2px 0px 0px 0px rgb(128, 128, 128, 0.4);
}
.empty .v-btn {
opacity: 0.4;