Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invariant Violation: Expected drag drop context #59

Open
Gaoxw5711 opened this issue Aug 13, 2023 · 7 comments
Open

Invariant Violation: Expected drag drop context #59

Gaoxw5711 opened this issue Aug 13, 2023 · 7 comments

Comments

@Gaoxw5711
Copy link

Why do I use dnd to report an error in my application, is there a problem with the usage method, and how can I adjust it?
image
image

@hcg1023
Copy link
Owner

hcg1023 commented Aug 14, 2023

First of all, you should first confirm whether the DndProvider is used in the upper component and the correct attributes are passed
If you are sure that there is no problem with the above steps, but you still encounter the above error, you can check whether there are two vue-demi in node_modules at the same time (for example, vueuse and vue3-dnd are installed at the same time), or exist at the same time Two different versions of vue etc.
If you encounter such a problem, I suggest you use pnpm install to solve it

@LIUSHUAI2018
Copy link

我也出现了这个问题,我使用的是pnpm install,我的项目里面的确有vueuse

@hcg1023
Copy link
Owner

hcg1023 commented Sep 14, 2023

我也出现了这个问题,我使用的是pnpm install,我的项目里面的确有vueuse

可以检查一下,看看是不是安装了两个不同版本的vue

@LIUSHUAI2018
Copy link

image

image

我也出现了这个问题,我使用的是pnpm install,我的项目里面确实有vueuse

可以检查一下,看看是不是安装了两个不同版本的vue

@LIUSHUAI2018
Copy link

我也出现了这个问题,我使用的是pnpm install,我的项目里面确实有vueuse

可以检查一下,看看是不是安装了两个不同版本的vue

这个是个非常简单的实例,除了vue和vuednd没有其他依赖
image

@hcg1023
Copy link
Owner

hcg1023 commented Sep 15, 2023

你这段代码出现这个的原因在于,你的DndProvider没有放到上层组件,或者你把drop封装成一个单独的组件,DndProvider和useDrop/useDrag/useDragLayer在同一个组件内时,确实会出现这种问题,原因是provider和inject找的是上层组件,而不是当前组件 @LIUSHUAI2018

@LIUSHUAI2018
Copy link

可能代码出现这个问题的原因是,你的DndProvider没有放到上层组件,或者你把drop封装做成一个单独的组件,DndProvider和useDrop/useDrag/useDragLayer在同一个组件内时,确实会出现这种问题,原因是provider和inject找的是上层组件,而不是当前组件@LIUSHUAI2018

ok了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants