1
I just want a index of items of get both source and target items :
1.drageed item
2.on which item it is dropped

有什么方法可以获取索引。

我尝试了 itemChangeCallback - 它给了我 2 次相互交换但它没有给我它们的索引

4

1 回答 1

0

试试下面的代码:D

const droppedItem = document.getElementById(".dropped");
const index = items.findIndex(item => item.id === droppedItem.id);
console.log(index);
于 2022-01-05T09:06:09.830 回答