Skip to content

Commit 24a5cde

Browse files
author
pc-david\david.desmaisons
committed
Allow event with no list
1 parent d65c790 commit 24a5cde

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/vuedraggable.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@
158158

159159
onDragStart (evt) {
160160
if (!this.list) {
161-
return
161+
return true
162162
}
163163
this.context = this.getUnderlyingVm(evt.item)
164164
evt.item._underlying_vm_ = this.clone(this.context.element)
@@ -168,7 +168,7 @@
168168
onDragAdd (evt) {
169169
const element = evt.item._underlying_vm_
170170
if (!this.list || element === undefined) {
171-
return
171+
return true
172172
}
173173
removeNode(evt.item)
174174
const indexes = this.visibleIndexes
@@ -182,13 +182,13 @@
182182

183183
onDragRemove (evt) {
184184
if (!this.list) {
185-
return
185+
return true
186186
}
187187
insertNodeAt(this.rootContainer, evt.item, evt.oldIndex)
188188
const isCloning = !!evt.clone
189189
if (isCloning) {
190190
removeNode(evt.clone)
191-
return
191+
return true
192192
}
193193
const oldIndex = this.context.currentIndex
194194
this.list.splice(oldIndex, 1)
@@ -197,7 +197,7 @@
197197

198198
onDragUpdate (evt) {
199199
if (!this.list) {
200-
return
200+
return true
201201
}
202202
removeNode(evt.item)
203203
insertNodeAt(evt.from, evt.item, evt.oldIndex)
@@ -209,9 +209,10 @@
209209

210210
onDragMove (evt) {
211211
const validate = this.validateMove
212-
if (!validate) {
212+
if (!validate || !list) {
213213
return true
214214
}
215+
215216
if (evt.to === evt.from) {
216217
const destination = this.getUnderlyingVm(evt.related)
217218
console.log('destination', destination)

0 commit comments

Comments
 (0)