-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
vnode.component is null, inside a custom directive's hooks, when it is used onto a Vue component #1700
Comments
I tried it and it work fine. |
@Picknight could you provide a codesandbox like I did? You can fork mine as well. Because mine contradics what you are saying, but perhaps you are using a different version of Vue 3 or you are doing something different. Thanks 🙂 |
I can confirm that |
Sorry, I misunderstood your question. My fault. Let me see what I can do to help you. @jfet97 |
This is expected behavior. Directives are meant for DOM manipulations. When they are used on a component, they fallthrough like attributes (e.g. |
Version
3.0.0-rc.4
Reproduction links
codesandbox
codepen
P.S. you should use the browser console
Steps to reproduce
.component
will benull
What is expected?
Is
vnode.component
the v3 corresponding of v2vnode.componentInstance
, isn't it?If a custom directive is used onto a Vue component, the
vnode.component
shouldn't be a reference to it?What is actually happening?
It is
null
😕Maybe is related to the fact that v3 allows more than one root node, but as you can see the problem persists when there is only one root node as well.
For the sake of completeness, here it is a codepen where v2 is used and
vnode.componentInstance
is what it is expected.I don't know why, but you have to keep the codepen console open to properly see the logged vnodes inside the browser console.
The text was updated successfully, but these errors were encountered: