Merge branch 'master' into fix-issue#14

This commit is contained in:
ayou
2018-12-11 10:29:07 +08:00
committed by GitHub
4 changed files with 22 additions and 7 deletions

View File

@@ -1,5 +1,3 @@
let nodeId = 1
/**
* Tree data struct
* Created by ayou on 2017/7/20.
@@ -13,7 +11,7 @@ let nodeId = 1
const TreeNode = function (data) {
const { id, isLeaf } = data
// this.name = name
this.id = (typeof id === 'undefined') ? ('new' + nodeId++) : id
this.id = (typeof id === 'undefined') ? new Date().valueOf() : id
this.parent = null
// this.pid = null
this.children = null

View File

@@ -69,10 +69,11 @@
@dragleave="dragLeaveBottom"></div>
</div>
<div :class="{'vtl-tree-margin': model.name !== 'root'}" v-show="expanded" v-if="isFolder">
<div :class="{'vtl-tree-margin': model.name !== 'root'}" v-show="model.name === 'root' || expanded" v-if="isFolder">
<item v-for="model in model.children"
:default-tree-node-name="defaultTreeNodeName"
:default-leaf-node-name="defaultLeafNodeName"
v-bind:default-expanded="defaultExpanded"
:model="model"
:key='model.id'>
</item>
@@ -94,7 +95,7 @@
isDragEnterUp: false,
isDragEnterBottom: false,
isDragEnterNode: false,
expanded: true
expanded: this.defaultExpanded
}
},
props: {
@@ -111,7 +112,11 @@
},
onDeleteNode: {
type: Function,
default: (confirm) => {confirm()}
default: (confirm) => {confirm()
},
defaultExpanded: {
type: Boolean,
default: true
}
},
computed: {