React.Dnd搭配AntV X6实现画布,使用的useDrag和useDrop,拖动节点后无法在画布上显示出来 #2062
Unanswered
xiazhaohui
asked this question in
Q&A
Replies: 1 comment 1 reply
-
已实现拖放目的,但仍有点小问题,使用react组件拖拽,如何将组件传递到画布区域? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
有一个需求,使用React.Dnd搭配AntV X6来实现拖拽画布。
使用的是useDrag和useDrop的hook,给要拖拽的节点设置了useDrag的ref,并且给画布也设置了useDrop的ref。现在效果是,可以拖拽,但是无法正常落在画布区域生成一个新节点。
我的问题是,为什么节点移动到画布区域无法生成一个节点? 我看到官网上有一个部分类似的例子,但是那个是用旧的API实现的,没有使用useDrag这个hook,请大佬掌掌眼🌻
部分业务代码如下:
效果如下截图和视频所示:
![iShot2022-04-26_19 13 14](https://user-images.githubusercontent.com/82207908/165288787-ed4378ce-d8e5-44b0-877a-2b94ffdbcd3d.png)
iShot2022-04-26_19.14.28.mp4
Beta Was this translation helpful? Give feedback.
All reactions