Skip to content

Commit 64c9219

Browse files
committed
1.0.2 fix an issue about cross tree
1 parent 782191c commit 64c9219

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "he-tree-vue",
3-
"version": "1.0.1",
3+
"version": "1.0.2",
44
"description": "A draggable sortable nested vue tree component.",
55
"main": "dist/he-tree-vue.cjs.js",
66
"module": "dist/he-tree-vue.esm.js",

src/examples/NodeBack.vue

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22
<template lang="pug">
33
div
44
h2 Node Back
5-
Tree.tree-with-nodeba-back(:value="treeData" idMode ref="tree")
5+
Tree.tree-with-nodeba-back(:value="treeData" ref="tree")
66
div(slot-scope="{node, index, path, tree}")
77
b(v-if="node.children && node.children.length > 0" @click="tree.toggleFold(node, path)") {{node.$folded ? '+' : '-'}}&nbsp;
88
input(type="checkbox" :checked="node.$checked" @change="tree.toggleCheck(node, path)")
99
| &nbsp;
1010
span {{node.text}}
11+
hr
12+
Tree.tree-with-nodeba-back(:value="treeData2" ref="tree2")
1113
</template>
1214

1315
<script>
@@ -37,6 +39,20 @@ export default {
3739
{text: 'node 1-9'},
3840
]},
3941
],
42+
treeData2: [
43+
{text: 'node 1', children: [
44+
{text: 'node 1-0'},
45+
{text: 'node 1-1'},
46+
{text: 'node 1-2'},
47+
{text: 'node 1-3'},
48+
{text: 'node 1-4'},
49+
{text: 'node 1-5'},
50+
{text: 'node 1-6'},
51+
{text: 'node 1-7'},
52+
{text: 'node 1-8'},
53+
{text: 'node 1-9'},
54+
]},
55+
],
4056
}
4157
},
4258
// computed: {},

src/plugins/draggable/Draggable.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export default {
162162
const path = tree.getPathByBranchEl(branchEl)
163163
const findPath = hp.arrayWithoutEnd(path, 1)
164164
let cur = path
165-
for (const {node, path} of this.iteratePath(findPath, {reverse: true})) {
165+
for (const {node, path} of tree.iteratePath(findPath, {reverse: true})) {
166166
if (tree.isNodeDroppable(node, path)) {
167167
return tree.getBranchElByPath(cur)
168168
} else {

0 commit comments

Comments
 (0)