【发布时间】:2019-07-01 14:25:04
【问题描述】:
我在我的应用程序中使用 Aurelia-Dragula (https://github.com/michaelmalonenz/aurelia-dragula),我想像在非 Aurelia Dragula 中一样为每个容器设置选项。
在我的情况下,我想在我想要 option.copy = true 的地方拥有 ContainerA,在我想要 option.removeOnSpill = true 的地方拥有 ContainerB。所以我都尝试了:
.plugin('aurelia-dragula', (options) => {
options.removeOnSpill = true;
options.copy = true;
})
但结果是复制占了上风,removeOnSpill 不起作用。
登录到控制台时,选项变量在 aurelia-dragula 中的外观:
{"containers":[],"copy":true,"copySortSource":false,"revertOnSpill":true,"removeOnSpill":true,"direction":"vertical","ignoreInputTextSelection":true,"mirrorContainer":{}}
如何在非 Aurelia Dragula 中完成的示例(来源:https://bevacqua.github.io/dragula/):
dragula([document.getElementById(left), document.getElementById(right)], {
copy: function (el, source) {
return source === document.getElementById(left)
},
accepts: function (el, target) {
return target !== document.getElementById(left)
}
});
由于选项设置的不同,我在 aurelia-dragula 中找不到这方面的文档,我无法翻译它。
【问题讨论】:
-
看来作者最近刚刚对lib做了一些改动,也许你应该在repo中问一下?我知道这违背了提交错误的精神,但那里的交通仍然很顺畅,所以我猜他不会介意在那里回答你。如果你能得到答案,如果你能在这里发一个链接就太好了。
-
非常感谢您的回复。由于您描述的相同原因,我不想在回购中询问,但如果这里没有更多回复,我可能会在明天这样做。
-
在 repo 中创建问题:github.com/michaelmalonenz/aurelia-dragula/issues/52