如何使用 Vanilla Js 拖放存储已放置项目的状态?

Posted

技术标签:

【中文标题】如何使用 Vanilla Js 拖放存储已放置项目的状态?【英文标题】:How do I store the state of a dropped item using Vanilla Js Drag and Drop? 【发布时间】:2019-11-27 22:13:34 【问题描述】:

我正在尝试存储可拖动项目的状态,以便将它们拖放到网络应用程序的任何位置。我正在使用jKanban Library

我希望将item-1Board A拖到Board B,重启应用并在Board B中找到item-1

【问题讨论】:

ondrop 存储一个值。 【参考方案1】:

为我工作试试。

 dropEl: function(el, target, source, sibling)
         console.log (el.getAttribute('data-eid')); // ID OF ELEMENT - TASK
         console.log(target.parentElement.getAttribute('data-id')); // ID OF BOARD 
  );

【讨论】:

以上是关于如何使用 Vanilla Js 拖放存储已放置项目的状态?的主要内容,如果未能解决你的问题,请参考以下文章