Replies: 5 comments
-
This should be relevant for you: vuejs/core#1682 (comment) You didn't explain what use case makes you need a Ref inside the directive |
Beta Was this translation helpful? Give feedback.
-
@posva I was trying to create a |
Beta Was this translation helpful? Give feedback.
-
Maybe we can make |
Beta Was this translation helpful? Give feedback.
-
@yyx990803 makeExplicit? |
Beta Was this translation helpful? Give feedback.
-
I would like to add support for this feature. I'm utilizing a library that expects a ref. The way you normally use it is on the actual component itself, but I would like to have the ref come from a parent and then use the function in the child. I cannot accomplish this because the ref is automatically unwrapped which causes value to be undefined which is the property that the library acts on.
|
Beta Was this translation helpful? Give feedback.
-
What problem does this feature solve?
Not unwrappable refs will be able to passed as values to custom directives without loosing their essence
I was building a custom directive that needs a ref as a value, to then perform some changes to that ref in response to some events.
I was just experimenting, nothing too serious, but unfortunately I later realized that the automatic refs unwrapping when a ref is used inside a template will always prevents the creation of this kind of directives.
We are forced to use reactive to create a sort of notUnwrappableRef and for consistency we end up creating a reactive object with only one reactive property: value.
What does the proposed API look like?
Something like the following, but standardized for every user
Beta Was this translation helpful? Give feedback.
All reactions