.sortable-chosen ghost
拖拽时添加的高亮元素
onEnd
Sortable.create(item, {
animation: 150,
ghostClass: styled.blue,
group: {
name: 'items',
pull: 'clone',
put: false, // 禁止拖拽到当前列表
},
setData: function (dataTransfer, dragEl) {
console.log('set', dataTransfer, dragEl);
// `dataTransfer` object of HTML5 DragEvent
dataTransfer.setData('Text', dragEl.textContent);
},
// Element dragging ended
onEnd: function (e) {
const {
item, from, to, oldIndex, newIndex,
oldDraggableIndex, newDraggableIndex,
clone, pullMode,
} = e;
console.log('end', e);
// item dragged HTMLElement
// to target list
// from previous list
// oldIndex element's old index within old parent
// newIndex element's new index within new parent
// oldDraggableIndex; element's old index within old parent, only counting draggable elements
// newDraggableIndex; element's new index within new parent, only counting draggable elements
// clone; the clone element
// pullMode; when item is in another sortable: `"clone"` if cloning, `true` if moving
},
});