如何在React JS中垂直和水平拖动?

发布于 2025-02-11 05:52:35 字数 524 浏览 0 评论 0原文

我是React js的新手,我需要在同一情况下垂直和水平拖放列表,我使用了 react-beautiful-dnd ,但是这个库一次仅支持一个方向,因此,我有什么办法可以同时拖放水平和垂直,

这是链接 https://codesandbox.io/s/react-beautiful-dnd-horizo​​ntal-list-list-list-forked-1xijl8?file=/index.js

假设我需要将item9拖动到item7位置,那么如果我将item9拖动到item7中,那么它的行为是错误的,正确的行为是item7位置将用item9填充

任何帮助。

注意:我不想使用溢出:自动显示光标

I am new to react JS , I need to drag and drop the list vertically and horizontally at the same it , I have used react-beautiful-dnd , but this library only support one direction at a time , so is there any way I can drag and drop horizontal and vertically at same time ,

Here is the link https://codesandbox.io/s/react-beautiful-dnd-horizontal-list-forked-1xijl8?file=/index.js

In this Suppose I need to drag Item9 to Item7 position , then If I drag Item9 over to Item7 then it behave wrong , correct behavior is Item7 position will be filled with Item9

Any help will be apricated.

NOTE : I don't want to use overflow : auto to show cursor , If Items are more then these should be start from next line rather showing scroller

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文