fix: 拖拽节点到根节点报错

This commit is contained in:
chenjianxing 2021-02-04 17:43:13 +08:00
parent ad1c9d3ffe
commit 6bad2e75df
4 changed files with 57 additions and 50 deletions

View File

@ -11,6 +11,7 @@
@edit="edit"
@drag="drag"
@remove="remove"
@refresh="list"
@nodeSelectEvent="nodeChange"
ref="nodeTree">

View File

@ -11,6 +11,7 @@
@edit="edit"
@drag="drag"
@remove="remove"
@refresh="list"
@nodeSelectEvent="nodeChange"
ref="nodeTree">

View File

@ -220,6 +220,10 @@ export default {
if (dropType === "none" || dropType === undefined) {
return;
}
if (dropNode.data.id === 'root' && dropType === 'before') {
this.$emit('refresh');
return false;
}
let param = this.buildParam(draggingNode, dropNode, dropType);
let list = [];
this.getNodeTree(this.treeNodes, draggingNode.data.id, list);

View File

@ -8,6 +8,7 @@
@drag="drag"
@remove="remove"
@nodeSelectEvent="nodeChange"
@refresh="list"
ref="nodeTree"/>
</template>