只有當打字稿中的變數為真時,有什么方法可以拖動,拖動后我可以呼叫一個函式將此排序直接保存到資料庫嗎?到目前為止,我解決了 drop 后的自動保存問題,但我不能將兩項服務與 dragula 一起使用(一個用于處理,另一個用于呼叫排序功能)
我不能同時使用這兩種服務
this.dragulaService.createGroup('chapters-list', {
moves: function (el, container, handle) {
//the only way I found here is just to check if a class name exists in the html
}
});
this.dragulaService.out('chapters-list').subscribe((value) => {
this.updateSorting();//This works fine after drop it will update to db
});
uj5u.com熱心網友回復:
唯一可行的方法是在 TS 中設定布爾變數并檢查該變數是否為真,然后添加/洗掉類
<div [ngClass]="canDrag?'':'edit-mode'">
并在 Dragula createGroup 添加此條件
return !handle.classList.contains('edit-mode');
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/522012.html
標籤:有角度的
