vue-easy-dnd
Version:
Easy-DnD is a drag and drop implementation for Vue 3 that uses only standard mouse events instead of the HTML5 drag and drop API, which is [impossible to work with](https://www.quirksmode.org/blog/archives/2009/09/the_html5_drag.html). Think of it as a wa
40 lines (33 loc) • 616 B
JavaScript
export class DnDEvent {
type;
data;
top;
previousTop;
source;
position;
success;
native;
}
export class ReorderEvent {
from;
to;
constructor (from, to) {
this.from = from;
this.to = to;
}
apply (array) {
const temp = array[this.from];
array.splice(this.from, 1);
array.splice(this.to, 0, temp);
}
}
export class InsertEvent {
type;
data;
index;
constructor (type, data, index) {
this.type = type;
this.data = data;
this.index = index;
}
}