From 3f859d3ee77dbf159c98aa30ec0ec172baf7abc8 Mon Sep 17 00:00:00 2001 From: wangcheng26 <66863386+wangcheng26@users.noreply.github.com> Date: Thu, 6 Jan 2022 17:16:38 +0800 Subject: [PATCH] #63 & #64 fix the drag and drop bug in the workspace directory (#65) --- src/page/Workspace/Wrapper/WorkspaceList.vue | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/page/Workspace/Wrapper/WorkspaceList.vue b/src/page/Workspace/Wrapper/WorkspaceList.vue index fa4c57c..edd8dad 100644 --- a/src/page/Workspace/Wrapper/WorkspaceList.vue +++ b/src/page/Workspace/Wrapper/WorkspaceList.vue @@ -16,7 +16,7 @@
- v.id && (v.name === name && v.type === type)).length > 1 const notebookId = draggingNode.data.id @@ -337,12 +338,13 @@ export default class WorkspaceList extends Vue { let targetFolder = '' let targetFolderChildren = [] if (dropType === 'inner') { - targetFolder = dropNode.data || dropNode.parent.data + targetFolder = dropNode.data.type === 'folder' ? dropNode.data : dropNode.parent.data targetFolderChildren = dropNode.data.children } else { - targetFolder = Array.isArray(dropNode.parent.data) ? '' : dropNode.parent.data + targetFolder = dropNode.parent.data targetFolderChildren = Array.isArray(dropNode.parent.data) ? dropNode.parent.data : dropNode.parent.data.children } + targetFolder = Array.isArray(targetFolder) ? '' : targetFolder let hasExsited = targetFolderChildren.filter(v => v.folder_id && (v.name === draggingNode.data.name)).length > 1 const currentFolderId = draggingNode.data.folder_id const currentParentFolder = this.findParentFolder(currentFolderId, this.originalList, 'folder') @@ -386,7 +388,7 @@ export default class WorkspaceList extends Vue { allowDrag () { return true } -} +} \ No newline at end of file +