Skip to content

Commit

Permalink
fix(draggable plugin): add event before-drop, move drop event to corr…
Browse files Browse the repository at this point in the history
…ect position
  • Loading branch information
phphe committed Jun 11, 2020
1 parent dd1cc15 commit 2bad9f7
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/plugins/draggable/Draggable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ export default {
if (targetTree.hasHook('ondragend') && targetTree.executeHook('ondragend', [targetTree, store]) === false) {
return false
}
targetTree.$emit('drop', store)
this.$root.$emit('he-tree-drop', store)
targetTree.$emit('before-drop', store)
this.$root.$emit('he-tree-before-drop', store)
},
afterDrop: (store, t) => {
if (store.pathChanged) {
Expand Down Expand Up @@ -290,10 +290,12 @@ export default {
targetSiblings.splice(targetIndex, 0, dragNode)
// emit event
startTree.$emit('input', startTree.treeData)
startTree.$emit('change')
startTree.$emit('change', store)
targetTree.$emit('drop', store)
this.$root.$emit('he-tree-drop', store)
if (targetTree !== startTree) {
targetTree.$emit('input', targetTree.treeData)
targetTree.$emit('change')
targetTree.$emit('change', store)
}
return new Promise((resolve, reject) => {
targetTree.$nextTick(() => {
Expand Down

0 comments on commit 2bad9f7

Please sign in to comment.