一旦将项目从bs-sortable部分中拖动出来,它将存储在缓存中,并且每当外部元素(例如:菜单被拖动时,先前拖动的项目就会出现在sortable部分中。
从提供的gif中查找更多信息:
这里是原始链接:
https://valor-software.com/ngx-bootstrap/#/sortable
任何想法如何解决此问题...
提前感谢。
我刚刚解决了上述问题。如果有人在寻找答案,这是代码。
转到node_modules并在以下位置编辑sortable.component.js文件:node_modules / ngx-bootstrap / sortable / sortable.component.js
如下所示在函数内添加标志变量,
function SortableComponent(transfer) {
...
this.itemFlag = false;
...
}
SortableComponent.prototype.onItemDragstart = function (event, item, i) {
this.itemFlag = true;
...
};
SortableComponent.prototype.onItemDragover = function (event, i) {
if(!this.itemFlag){
return;
}
...
};
SortableComponent.prototype.writeValue = function (value) {
this.itemFlag = false;
...
};
这解决了我的问题!。