【发布时间】:2019-02-18 08:11:18
【问题描述】:
显然 1.5.0 支持 this.dragulaService.setOptions 而 2.1.1 不支持,反之亦然,而 2.1.1 支持 this.dragulaService.drop 订阅 1.5.0 不支持。
相关代码注意:
1.5.0(不工作)
无法调用类型缺少调用签名的表达式。类型 “EvenEmitter”没有兼容的调用签名。 (财产) AppComponent.dragulaService: DragulaService
this.dragulaService.drop("dnd")
.subscribe(({ name, el, target, source, sibling }) => {
//content
}
1.5.0(工作)
this.dragulaService.setOptions('dnd', {
moves: (el, source, handle, sibling) => !el.classList.contains('nodrag')
});
2.1.1(工作)
this.dragulaService.drop("dnd")
.subscribe(({ name, el, target, source, sibling }) => {
//content
}
2.1.1(不工作)
this.dragulaService.createGroup("dnd", {
moves: (el, source, handle, sibling) => !el.classList.contains('nodrag')
});
'{moves: (el: any, source: any, handle: any,兄弟: 任何)=> 布尔值; }' 不可分配给类型参数 'Dragula 选项'。对象字面量只能指定已知 属性,并且在“Dragula Options”类型中不存在“moves”。 (参数)句柄:任何
注意,虽然有 migration guide 和 changelog,但它确实有 state how to replace the setOptions into create group。但在我的情况下它仍然不起作用。
有没有办法同时使用这两个功能?还是我错过了一些明显的东西?
【问题讨论】:
标签: angular ng2-dragula