简体   繁体   English

拖放angular2 Dragula

[英]Drag and Drop angular2 Dragula

I'm using ng2-dragula to drag and drop elements. 我正在使用ng2-dragula拖放元素。 I need that my drag&drop be in one direction 我需要我的拖放方向是一个方向

for example I have a menu of items and I fill my div with this items so its not logical to drag from my div to menu. 例如,我有一个菜单项,并且我用这个项目填充了div,因此将其从div拖动到菜单是不合逻辑的。

I had already found this config to keep my items in menu 我已经找到了此配置以将菜单项保留在菜单中

 this.dragulaService.setOptions('first-bag', {
            copy: true,
        });

Add an 'id' to your menu and change your setOptions as follow: 在菜单中添加一个“ id”并按如下所示更改setOptions:

this.dragulaService.setOptions('first-bag', {
  accepts: function (el, target, source, sibling) {
    return (target.id != 'dragula-source');
  },
  copy: true
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM