克隆后如何删除dragula中的元素



从父容器id=left-copy-1tomany拖动元素后,我希望从克隆容器id=right-copy-1tomany中删除一些克隆的元素。我想通过使用removeOnSpill: true函数来移除它们,该函数应该允许我将元素从容器中拖出来以移除它。有没有方法可以使用克隆代码来实现这一点?

HTML

<div class='parent'>
<div class='wrapper'>
<div id='right-copy-1tomany' class='container'></div>
<div id='left-copy-1tomany' class='container'>
<div>TEST BOX 1</div>
<div>TEST BOX 2</div>
<div>TEST BOX 3</div>
<div>TEST BOX 4</div>
<div>TEST BOX 5</div>
</div>
</div>
</div>
</div>
<h4>Dragule Code:</h4>

JS

dragula([document.getElementById(left), document.getElementById(right)],{
accepts: function (el, target) {
return target !== document.getElementById(right);
},
copy: function (el, source) {
return source === document.getElementById(right);
},
removeOnSpill: true,
}
});

dropModel((事件中尝试el.remove():

this.dragulaService.dropModel("<dragula-id>")
.subscribe(({ name, el, target, source, sibling, sourceModel, targetModel, item }) => {
if (<condition-to-remove>) {
el.remove()
}
});

相关内容

  • 没有找到相关文章

最新更新