簡體   English   中英

ngx-bootstrap bs-sortable 在將菜單項拖動到可排序部分時顯示先前拖動的項目

[英]ngx-bootstrap bs-sortable shows prevously dragged item when a menu item is dragged to the sortable section

一旦從 bs-sortable 部分中拖動一個項目,它就會存儲在緩存中,並且每當一個外部元素(例如:菜單被拖動)時,先前拖動的項目就會出現在可排序部分中。

從提供的 gif 中查找更多信息:

https://lh3.googleusercontent.com/-ztVT2dV-Z4g/Xc5k5syOL2I/AAAAAAAAKeI/KmfvezqDx4425kTLr6TgHpFilX90fSF4wCK8BGAsYHg/s0/2019-11-15.gif

這是原始鏈接:

https://valor-software.com/ngx-bootstrap/#/sortable

任何想法如何解決這個問題...

提前致謝。

我剛剛解決了上述問題。 如果有人正在尋找答案,這是代碼。

Go 到 node_modules 並編輯該位置的sortable.component.js文件:
node_modules/ngx-bootstrap/sortable/sortable.component.js

在function里面添加一個flag變量,如下圖,

 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. ..; };

這解決了我的問題。!

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM