Skip to content

Commit 3b7c331

Browse files
committed
添加 options.accept 处理接受拖拽的元素
1 parent 27fa2f9 commit 3b7c331

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Sortable.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
fallbackClass: 'sortable-fallback',
226226
fallbackOnBody: false,
227227
scrollContainer: null,
228-
allowTransform:true
228+
allowTransform: true
229229
};
230230

231231

@@ -603,6 +603,12 @@
603603
!options.dragoverBubble && evt.stopPropagation();
604604
}
605605

606+
//如果拖动的目标区域 accept 设置了, 当前拖拽元素不满足,直接返回
607+
if (activeGroup && activeGroup.name === group.name
608+
&& evt.rootEl[expando].options.accept
609+
&& !_matches(dragEl, evt.rootEl[expando].options.accept)) {
610+
return;
611+
}
606612
moved = true;
607613

608614
if (activeGroup && !options.disabled &&

0 commit comments

Comments
 (0)